From 0d58a04596f4ee1cbb8f26a2c092189ec1ae13b2 Mon Sep 17 00:00:00 2001 From: XeR Date: Mon, 8 May 2023 03:40:57 +0200 Subject: [PATCH] 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 --- CONTRIBUTORS | 1 + rslib/src/backend/sync/mod.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index fa8a8f700..555a229ae 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -119,6 +119,7 @@ Ingemar Berg Ben Kerman Euan Kemp Kieran Black +XeR ******************** diff --git a/rslib/src/backend/sync/mod.rs b/rslib/src/backend/sync/mod.rs index 952190c42..0f83f3d5b 100644 --- a/rslib/src/backend/sync/mod.rs +++ b/rslib/src/backend/sync/mod.rs @@ -90,7 +90,7 @@ impl TryFrom for SyncAuth { // are detected but URLs like computer.local:8000 are not. // By calling join() now, these URLs are detected too and later code that // 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.") }) .transpose()?,