]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
ConfTextStorage: lowercase only once
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 15 Feb 2019 20:10:58 +0000 (21:10 +0100)
committerRoopesh Chander <roop@roopc.net>
Sat, 16 Feb 2019 11:48:10 +0000 (17:18 +0530)
Also fix submodule regression.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift
wireguard-go

index caa2bc44afe79e80e76b076dcce69b3a8a56ee24..077ee1eea932085e00f7b871b43c16a497543f53 100644 (file)
@@ -100,14 +100,13 @@ class ConfTextStorage: NSTextStorage {
         resetLastPeer()
         while spans.pointee.type != HighlightEnd {
             let span = spans.pointee
-            var substring = backingStore.attributedSubstring(from: NSRange(location: span.start, length: span.len)).string
+            var substring = backingStore.attributedSubstring(from: NSRange(location: span.start, length: span.len)).string.lowercased()
 
             if span.type == HighlightError {
                 resetLastPeer()
                 return
-            }
-            if span.type == HighlightSection {
-                if substring.lowercased() == "[peer]" {
+            } else if span.type == HighlightSection {
+                if substring == "[peer]" {
                     if hasOnePeer {
                         resetLastPeer()
                         return
@@ -115,7 +114,7 @@ class ConfTextStorage: NSTextStorage {
                     hasOnePeer = true
                 }
             } else if span.type == HighlightField {
-                fieldType = FieldType(rawValue: substring.lowercased())
+                fieldType = FieldType(rawValue: substring)
             } else if span.type == HighlightIP && fieldType == .dns {
                 lastOnePeerDNSServers.append(substring)
             } else if span.type == HighlightIP && fieldType == .allowedips {
index c4b43e35a772305858e610d879c2b9d47f4d9866..f7170e5de2065f37bac647484b34711db4797394 160000 (submodule)
@@ -1 +1 @@
-Subproject commit c4b43e35a772305858e610d879c2b9d47f4d9866
+Subproject commit f7170e5de2065f37bac647484b34711db4797394