Fix a possible error purging orphaned storage server files if WebDAV server strips trailing slash
This commit is contained in:
parent
d5de9c7a4a
commit
6dbcc678c8
1 changed files with 7 additions and 1 deletions
|
@ -853,7 +853,7 @@ Zotero.Sync.Storage = new function () {
|
||||||
var lastSyncDate = new Date(Zotero.Sync.Server.lastLocalSyncTime * 1000);
|
var lastSyncDate = new Date(Zotero.Sync.Server.lastLocalSyncTime * 1000);
|
||||||
|
|
||||||
Zotero.Utilities.HTTP.WebDAV.doProp("PROPFIND", uri, xmlstr, function (req) {
|
Zotero.Utilities.HTTP.WebDAV.doProp("PROPFIND", uri, xmlstr, function (req) {
|
||||||
Zotero.debug(req.responseText);
|
Zotero.debug(req.responseText);
|
||||||
|
|
||||||
var funcName = "Zotero.Sync.Storage.purgeOrphanedStorageFiles()";
|
var funcName = "Zotero.Sync.Storage.purgeOrphanedStorageFiles()";
|
||||||
|
|
||||||
|
@ -861,9 +861,15 @@ Zotero.Sync.Storage = new function () {
|
||||||
var xml = new XML(req.responseText.replace(/<\?xml.*\?>/, ''));
|
var xml = new XML(req.responseText.replace(/<\?xml.*\?>/, ''));
|
||||||
|
|
||||||
var deleteFiles = [];
|
var deleteFiles = [];
|
||||||
|
var trailingSlash = !!path.match(/\/$/);
|
||||||
for each(var response in xml.D::response) {
|
for each(var response in xml.D::response) {
|
||||||
var href = response.D::href.toString();
|
var href = response.D::href.toString();
|
||||||
|
|
||||||
|
// Strip trailing slash if there isn't one on the root path
|
||||||
|
if (!trailingSlash) {
|
||||||
|
href = href.replace(/\/$/, "")
|
||||||
|
}
|
||||||
|
|
||||||
// Absolute
|
// Absolute
|
||||||
if (href.match(/^https?:\/\//)) {
|
if (href.match(/^https?:\/\//)) {
|
||||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue