fix: fix upstash sync issue

This commit is contained in:
Fred
2024-03-14 01:56:36 +08:00
parent 133ce39a13
commit 6aaf83f3c2
4 changed files with 27 additions and 18 deletions

View File

@@ -92,12 +92,16 @@ export function createUpstashClient(store: SyncStore) {
proxyUrl += "/";
}
let url = new URL(proxyUrl + "/api/upstash/" + path);
// add query params
url.searchParams.append("endpoint", config.endpoint);
return url.toString();
let url;
if (proxyUrl.length > 0 || proxyUrl === "/") {
let u = new URL(proxyUrl + "/api/upstash/" + path);
// add query params
u.searchParams.append("endpoint", config.endpoint);
url = u.toString();
} else {
url = "/api/upstash/" + path + "?endpoint=" + config.endpoint;
}
return url;
},
};
}

View File

@@ -67,12 +67,16 @@ export function createWebDavClient(store: SyncStore) {
proxyUrl += "/";
}
let url = new URL(proxyUrl + "/api/webdav/" + path);
// add query params
url.searchParams.append("endpoint", config.endpoint);
return url + path;
let url;
if (proxyUrl.length > 0 || proxyUrl === "/") {
let u = new URL(proxyUrl + "/api/webdav/" + path);
// add query params
u.searchParams.append("endpoint", config.endpoint);
url = u.toString();
} else {
url = "/api/upstash/" + path + "?endpoint=" + config.endpoint;
}
return url;
},
};
}