Config file parsing: Fix bug when there are comments at the end
This commit is contained in:
parent
8c4475111b
commit
e95cb6e6bd
|
@ -54,10 +54,9 @@ extension TunnelConfiguration {
|
|||
}
|
||||
|
||||
trimmedLine = trimmedLine.trimmingCharacters(in: .whitespaces)
|
||||
let lowercasedLine = trimmedLine.lowercased()
|
||||
|
||||
guard !trimmedLine.isEmpty else { continue }
|
||||
let lowercasedLine = line.lowercased()
|
||||
|
||||
if !trimmedLine.isEmpty {
|
||||
if let equalsIndex = line.firstIndex(of: "=") {
|
||||
// Line contains an attribute
|
||||
let keyWithCase = line[..<equalsIndex].trimmingCharacters(in: .whitespaces)
|
||||
|
@ -87,6 +86,7 @@ extension TunnelConfiguration {
|
|||
} else if lowercasedLine != "[interface]" && lowercasedLine != "[peer]" {
|
||||
throw ParseError.invalidLine(line)
|
||||
}
|
||||
}
|
||||
|
||||
let isLastLine = lineIndex == lines.count - 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue