From d1d70d3df8546a94e8dab0ab59346d3e33b97788 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 16 Dec 2009 00:06:53 +0000 Subject: [PATCH] Automatically delete .prop files that don't contain valid timestamps --- chrome/content/zotero/xpcom/storage/webdav.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index 8052cfe33..3a0a90969 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -225,6 +225,16 @@ Zotero.Sync.Storage.Session.WebDAV.prototype._getStorageModificationTime = funct mtime = req.responseText; } + // Delete invalid .prop files + if (!(mtime + '').match(/^[0-9]{10}$/)) { + var msg = "Invalid mod date '" + Zotero.Utilities.prototype.ellipsize(mtime, 20) + + "' for item " + Zotero.Items.getLibraryKeyHash(item) + " in " + funcName; + Zotero.debug(msg, 1); + self._deleteStorageFiles([item.key + ".prop"], null, self); + self.onError(msg); + return; + } + var mdate = new Date(mtime * 1000); callback(item, mdate); }); @@ -289,12 +299,6 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.downloadFile = function (request) { try { var syncModTime = Zotero.Date.toUnixTimestamp(mdate); - if (!syncModTime) { - var msg = "Invalid mod date '" + mdate + "' for item " - + Zotero.Items.getLibraryKeyHash(item) + " in " + funcName; - Zotero.debug(msg, 1); - throw (msg); - } // Skip download if local file exists and matches mod time var file = item.getFile();