Don't parse a block begin while inside a block
If a PEM contained anything like <foobar>, the parser was doomed. Fixes #78
This commit is contained in:
parent
d22420c06b
commit
ccb6329f05
@ -187,14 +187,16 @@ public class ConfigurationParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if unsupportedError == nil {
|
if unsupportedError == nil {
|
||||||
Regex.blockBegin.enumerateComponents(in: line) {
|
if currentBlockName == nil {
|
||||||
isHandled = true
|
Regex.blockBegin.enumerateComponents(in: line) {
|
||||||
let tag = $0.first!
|
isHandled = true
|
||||||
let from = tag.index(after: tag.startIndex)
|
let tag = $0.first!
|
||||||
let to = tag.index(before: tag.endIndex)
|
let from = tag.index(after: tag.startIndex)
|
||||||
|
let to = tag.index(before: tag.endIndex)
|
||||||
|
|
||||||
currentBlockName = String(tag[from..<to])
|
currentBlockName = String(tag[from..<to])
|
||||||
currentBlock = []
|
currentBlock = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Regex.blockEnd.enumerateComponents(in: line) {
|
Regex.blockEnd.enumerateComponents(in: line) {
|
||||||
isHandled = true
|
isHandled = true
|
||||||
|
Loading…
Reference in New Issue
Block a user