Skip to content

Commit 0f20913

Browse files
committed
Remove trailing slash from manual inputed server URL in onboarding
1 parent b500e74 commit 0f20913

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sources/App/Onboarding/Screens/OnboardingManualURLViewController.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ class OnboardingManualURLViewController: UIViewController, UITextFieldDelegate {
166166

167167
isConnecting = true
168168

169+
if let urlString = urlField.text {
170+
urlField.text = removeTrailingSlash(from: urlString)
171+
}
172+
169173
let authentication = OnboardingAuth()
170174

171175
firstly {
@@ -215,6 +219,14 @@ class OnboardingManualURLViewController: UIViewController, UITextFieldDelegate {
215219
}
216220
}
217221

222+
private func removeTrailingSlash(from string: String) -> String {
223+
if string.hasSuffix("/") {
224+
return String(string.dropLast())
225+
} else {
226+
return string
227+
}
228+
}
229+
218230
private func promptForScheme(for string: String) -> Promise<String> {
219231
Promise { seal in
220232
let alert = UIAlertController(

0 commit comments

Comments
 (0)