Skip to content

Commit ca6ab8c

Browse files
Merge pull request #95 from writeas/login-fail-gracefully-invalid-url
Remove URL path from server string before logging in
2 parents 69a9b5e + 73c0b12 commit ca6ab8c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Shared/Models/WriteFreelyModel.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ extension WriteFreelyModel {
9494
serverString = serverString.replacingOccurrences(of: insecureProtocolPrefix, with: secureProtocolPrefix)
9595
}
9696
isLoggingIn = true
97-
account.server = serverString
98-
client = WFClient(for: URL(string: serverString)!)
97+
var serverURL = URL(string: serverString)!
98+
if !serverURL.path.isEmpty {
99+
serverURL.deleteLastPathComponent()
100+
}
101+
account.server = serverURL.absoluteString
102+
client = WFClient(for: serverURL)
99103
client?.login(username: username, password: password, completion: loginHandler)
100104
}
101105

WriteFreely-MultiPlatform.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@
11411141
repositoryURL = "[email protected]:writeas/writefreely-swift.git";
11421142
requirement = {
11431143
kind = upToNextMajorVersion;
1144-
minimumVersion = 0.1.1;
1144+
minimumVersion = 0.2.3;
11451145
};
11461146
};
11471147
/* End XCRemoteSwiftPackageReference section */

0 commit comments

Comments
 (0)