diff options
author | Roopesh Chander <roop@roopc.net> | 2018-11-03 15:45:29 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-11-03 15:45:29 +0530 |
commit | 366ca7802af8f1f77f41ecf91fd32f8bf3cee082 (patch) | |
tree | 2cf1145e499842dc37097d0c8710beee5126e8b6 /WireGuard/WireGuard/UI/TunnelViewModel.swift | |
parent | Zip archive: Handle files within folders inside the zip (diff) | |
download | wireguard-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.swift | 2 |
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") } |