Skip to content

Commit

Permalink
Merge pull request #95 from writeas/login-fail-gracefully-invalid-url
Browse files Browse the repository at this point in the history
Remove URL path from server string before logging in
  • Loading branch information
AngeloStavrow authored Oct 12, 2020
2 parents 69a9b5e + 73c0b12 commit ca6ab8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions Shared/Models/WriteFreelyModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ extension WriteFreelyModel {
serverString = serverString.replacingOccurrences(of: insecureProtocolPrefix, with: secureProtocolPrefix)
}
isLoggingIn = true
account.server = serverString
client = WFClient(for: URL(string: serverString)!)
var serverURL = URL(string: serverString)!
if !serverURL.path.isEmpty {
serverURL.deleteLastPathComponent()
}
account.server = serverURL.absoluteString
client = WFClient(for: serverURL)
client?.login(username: username, password: password, completion: loginHandler)
}

Expand Down
2 changes: 1 addition & 1 deletion WriteFreely-MultiPlatform.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@
repositoryURL = "[email protected]:writeas/writefreely-swift.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.1.1;
minimumVersion = 0.2.3;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down

0 comments on commit ca6ab8c

Please sign in to comment.