From 71525c9d4e5fe929408233ce10f5af0d79bfc81a Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Tue, 5 Feb 2019 16:45:32 +0530 Subject: wg-quick conf parser: Handle inline comments correctly Signed-off-by: Roopesh Chander --- WireGuard/Shared/Model/TunnelConfiguration+WgQuickConfig.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'WireGuard/Shared/Model/TunnelConfiguration+WgQuickConfig.swift') diff --git a/WireGuard/Shared/Model/TunnelConfiguration+WgQuickConfig.swift b/WireGuard/Shared/Model/TunnelConfiguration+WgQuickConfig.swift index 65676f5..fa32de2 100644 --- a/WireGuard/Shared/Model/TunnelConfiguration+WgQuickConfig.swift +++ b/WireGuard/Shared/Model/TunnelConfiguration+WgQuickConfig.swift @@ -57,11 +57,11 @@ extension TunnelConfiguration { let lowercasedLine = trimmedLine.lowercased() if !trimmedLine.isEmpty { - if let equalsIndex = line.firstIndex(of: "=") { + if let equalsIndex = trimmedLine.firstIndex(of: "=") { // Line contains an attribute - let keyWithCase = line[.. = ["address", "allowedips", "dns"] if let presentValue = attributes[key] { if keysWithMultipleEntriesAllowed.contains(key) { -- cgit v1.2.3-59-g8ed1b