mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-05-05 15:21:54 +00:00
fix: strip trailing slash from couchDB_URI to avoid double-slash 401
When couchDB_URI ends with a trailing slash (e.g. https://host/), the database name concatenation produces a double-slash path (https://host//obsidiannotes), which causes CouchDB to reject requests with 401 "Name or password is incorrect". Strip trailing slashes from couchDB_URI / baseUri at the path concatenation sites in: - src/common/utils.ts (_requestToCouchDBFetch, _requestToCouchDB) - src/features/LocalDatabaseMainte/CmdLocalDatabaseMainte.ts The companion fix for the replication path is in the livesync-commonlib submodule. Ref: #859
This commit is contained in:
@@ -781,7 +781,8 @@ Success: ${successCount}, Errored: ${errored}`;
|
||||
const credential = generateCredentialObject(this.settings);
|
||||
const request = async (path: string, method: string = "GET", body: any = undefined) => {
|
||||
const req = await _requestToCouchDB(
|
||||
this.settings.couchDB_URI + (this.settings.couchDB_DBNAME ? `/${this.settings.couchDB_DBNAME}` : ""),
|
||||
this.settings.couchDB_URI.replace(/\/+$/, "") +
|
||||
(this.settings.couchDB_DBNAME ? `/${this.settings.couchDB_DBNAME}` : ""),
|
||||
credential,
|
||||
window.origin,
|
||||
path,
|
||||
|
||||
Reference in New Issue
Block a user