aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-02-15 21:10:58 +0100
committerRoopesh Chander <roop@roopc.net>2019-02-16 17:18:10 +0530
commit6f7214ff383d336511df32543275fd94ec8e955c (patch)
tree65ed464701ed52751bdb058252d782e79e6e0b74 /WireGuard
parentConfTextStorage: Let's keep the AllowedIPs and DNS servers as strings (diff)
downloadwireguard-apple-6f7214ff383d336511df32543275fd94ec8e955c.tar.xz
wireguard-apple-6f7214ff383d336511df32543275fd94ec8e955c.zip
ConfTextStorage: lowercase only once
Also fix submodule regression. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard')
-rw-r--r--WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift9
1 files changed, 4 insertions, 5 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift b/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift
index caa2bc44..077ee1ee 100644
--- a/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift
+++ b/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift
@@ -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 {