From 42c55ee5f3afd1cbf6d14e361bc415e8a74f2a87 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 16 Feb 2015 17:26:51 -0500 Subject: [PATCH] Fix file sync error with filenames containing slashes These shouldn't exist, but something either didn't used to or still isn't protecting against them, so strip them in getFile(). --- chrome/content/zotero/xpcom/data/item.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 1fca0ca08a..40fd22af03 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -2836,7 +2836,10 @@ Zotero.Item.prototype.getFile = function(row, skipExistsCheck) { // accidentally use the parent dir. Syncing to OS X, which doesn't // exhibit this bug, will properly correct such filenames in // storage.js and propagate the change - if (Zotero.isWin) { + // + // The one exception on other platforms is '/', which is interpreted + // as a directory by setRelativeDescriptor, so strip in that case too. + if (Zotero.isWin || path.indexOf('/') != -1) { path = Zotero.File.getValidFileName(path, true); } var file = Zotero.Attachments.getStorageDirectory(this.id);