From ff9e822bd37c63a328521c72f95bd0bb97a51215 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 26 Oct 2016 02:15:56 -0400 Subject: [PATCH] Fix errors filtering filenames of synced file downloads --- chrome/content/zotero/xpcom/storage/storageLocal.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/storage/storageLocal.js b/chrome/content/zotero/xpcom/storage/storageLocal.js index 992dc1d12..6ed7aba50 100644 --- a/chrome/content/zotero/xpcom/storage/storageLocal.js +++ b/chrome/content/zotero/xpcom/storage/storageLocal.js @@ -642,6 +642,7 @@ Zotero.Sync.Storage.Local = { return false; } + var dir = OS.Path.dirname(path); var fileName = OS.Path.basename(path); var renamed = false; @@ -651,7 +652,7 @@ Zotero.Sync.Storage.Local = { if (filteredName != fileName) { Zotero.debug("Filtering filename '" + fileName + "' to '" + filteredName + "'"); fileName = filteredName; - path = OS.Path.dirname(path, fileName); + path = OS.Path.join(dir, fileName); renamed = true; } @@ -670,7 +671,7 @@ Zotero.Sync.Storage.Local = { Zotero.debug("Changed filename '" + fileName + "' to '" + finalFileName + "'"); fileName = finalFileName; - path = OS.Path.dirname(path, fileName); + path = OS.Path.join(dir, fileName); // Abort if Windows path limitation would cause filenames to be overly truncated if (Zotero.isWin && fileName.length < 40) { @@ -859,7 +860,7 @@ Zotero.Sync.Storage.Local = { throw new Error(msg); } - destPath = OS.Path.join(OS.Path.dirname(destPath, shortened)); + destPath = OS.Path.join(OS.Path.dirname(destPath), shortened); if (primaryFile) { renamed = true;