From 6dbcc678c89f4cb33e478c3a174211f4d6239034 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 15 Mar 2009 16:07:52 +0000 Subject: [PATCH] Fix a possible error purging orphaned storage server files if WebDAV server strips trailing slash --- chrome/content/zotero/xpcom/storage.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js index 5f0caf74b6..1d73e221ef 100644 --- a/chrome/content/zotero/xpcom/storage.js +++ b/chrome/content/zotero/xpcom/storage.js @@ -853,7 +853,7 @@ Zotero.Sync.Storage = new function () { var lastSyncDate = new Date(Zotero.Sync.Server.lastLocalSyncTime * 1000); Zotero.Utilities.HTTP.WebDAV.doProp("PROPFIND", uri, xmlstr, function (req) { - Zotero.debug(req.responseText); + Zotero.debug(req.responseText); var funcName = "Zotero.Sync.Storage.purgeOrphanedStorageFiles()"; @@ -861,9 +861,15 @@ Zotero.Sync.Storage = new function () { var xml = new XML(req.responseText.replace(/<\?xml.*\?>/, '')); var deleteFiles = []; + var trailingSlash = !!path.match(/\/$/); for each(var response in xml.D::response) { var href = response.D::href.toString(); + // Strip trailing slash if there isn't one on the root path + if (!trailingSlash) { + href = href.replace(/\/$/, "") + } + // Absolute if (href.match(/^https?:\/\//)) { var ios = Components.classes["@mozilla.org/network/io-service;1"].