From 4ac1437c4b5993e55bf75d29d2761ba01ce657cb Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Tue, 5 Feb 2019 16:45:32 +0530 Subject: [PATCH] wg-quick conf parser: Handle inline comments correctly --- .../Shared/Model/TunnelConfiguration+WgQuickConfig.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) {