Fix sync client ignoring directories (#2490)

* Fix sync client ignoring directories

Current implementation of the sync client does not properly send requests to a
self-hosted sync server if the URL has directories.

If the self-hosted sync URL is `https://example.org/foo/bar/`, Anki is expected
to send requests to `https://example.org/foo/bar/sync/hostKey`. Instead, it will
discard the directories and wrongly send requests to
`https://example.org/sync/hostKey`.

Fixes: e5d5d1d ("Fix panic with invalid sync server URL with port")

* Add XeR to contributors
This commit is contained in:
XeR 2023-05-08 03:40:57 +02:00 committed by GitHub
parent fef2844d45
commit 0d58a04596
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -119,6 +119,7 @@ Ingemar Berg <github.com/ingemarberg>
Ben Kerman <ben@kermanic.org> Ben Kerman <ben@kermanic.org>
Euan Kemp <euank@euank.com> Euan Kemp <euank@euank.com>
Kieran Black <kieranlblack@gmail.com> Kieran Black <kieranlblack@gmail.com>
XeR <github.com/XeR>
******************** ********************

View file

@ -90,7 +90,7 @@ impl TryFrom<pb::sync::SyncAuth> for SyncAuth {
// are detected but URLs like computer.local:8000 are not. // are detected but URLs like computer.local:8000 are not.
// By calling join() now, these URLs are detected too and later code that // By calling join() now, these URLs are detected too and later code that
// uses and unwraps the result of join() doesn't panic // uses and unwraps the result of join() doesn't panic
.and_then(|x| x.join("/")) .and_then(|x| x.join("./"))
.or_invalid("Invalid sync server specified. Please check the preferences.") .or_invalid("Invalid sync server specified. Please check the preferences.")
}) })
.transpose()?, .transpose()?,