Remove path from server URL if it exists

This commit is contained in:
Angelo Stavrow 2020-10-06 16:49:19 -04:00
parent 609a33067b
commit 5b0874f14f
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -95,7 +95,11 @@ extension WriteFreelyModel {
}
isLoggingIn = true
account.server = serverString
client = WFClient(for: URL(string: serverString)!)
var serverURL = URL(string: serverString)!
if !serverURL.path.isEmpty {
serverURL.deleteLastPathComponent()
}
client = WFClient(for: serverURL)
client?.login(username: username, password: password, completion: loginHandler)
}