aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/TunnelViewModel.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-11-03 15:45:29 +0530
committerRoopesh Chander <roop@roopc.net>2018-11-03 15:45:29 +0530
commit366ca7802af8f1f77f41ecf91fd32f8bf3cee082 (patch)
tree2cf1145e499842dc37097d0c8710beee5126e8b6 /WireGuard/WireGuard/UI/TunnelViewModel.swift
parentZip archive: Handle files within folders inside the zip (diff)
downloadwireguard-apple-366ca7802af8f1f77f41ecf91fd32f8bf3cee082.tar.xz
wireguard-apple-366ca7802af8f1f77f41ecf91fd32f8bf3cee082.zip
Ensure that all tunnel names are trimmed of whitespaces
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/TunnelViewModel.swift')
-rw-r--r--WireGuard/WireGuard/UI/TunnelViewModel.swift2
1 files changed, 1 insertions, 1 deletions
diff --git a/WireGuard/WireGuard/UI/TunnelViewModel.swift b/WireGuard/WireGuard/UI/TunnelViewModel.swift
index a9ee6f8..8a9cba4 100644
--- a/WireGuard/WireGuard/UI/TunnelViewModel.swift
+++ b/WireGuard/WireGuard/UI/TunnelViewModel.swift
@@ -97,7 +97,7 @@ class TunnelViewModel {
func save() -> SaveResult<InterfaceConfiguration> {
fieldsWithError.removeAll()
- guard let name = scratchpad[.name], (!name.isEmpty) else {
+ guard let name = scratchpad[.name]?.trimmingCharacters(in: .whitespacesAndNewlines), (!name.isEmpty) else {
fieldsWithError.insert(.name)
return .error("Interface name is required")
}