From b22b395e22365c29deb1a0132d911ea66e5cd484 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 27 Apr 2011 19:08:14 +0000 Subject: [PATCH] Fix for occasional "DAV:href '/zotero' does not begin with path '/zotero/'" error on opening Zotero pane with WebDAV syncing enabled --- chrome/content/zotero/xpcom/storage/webdav.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index e45b49ce7..b2eb0e38d 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -1354,6 +1354,16 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.purgeOrphanedStorageFiles = functio href = href.path; } + // Skip root URI + if (href == path + // Some Apache servers respond with an "/zotero" href + // even for a "/zotero/" request + || (trailingSlash && href + '/' == path) + // Try URL-encoded as well, as above + || decodeURIComponent(href) == path) { + continue; + } + if (href.indexOf(path) == -1 // Try URL-encoded as well, in case there's a '~' or similar // character in the URL and the server (e.g., Sakai) is @@ -1363,13 +1373,6 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.purgeOrphanedStorageFiles = functio + "' does not begin with path '" + path + "' in " + funcName); } - // Skip root URI - if (href == path - // Try URL-encoded as well, as above - || decodeURIComponent(href) == path) { - continue; - } - var matches = href.match(/[^\/]+$/); if (!matches) { self.onError("Unexpected href '" + href + "' in " + funcName)