From b511e452a89b126a981f515fa39066e0d782baa3 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 20 May 2021 19:24:45 -0400 Subject: [PATCH] Mendeley import: Only limit paths to 260 characters on Windows --- chrome/content/zotero/import/mendeley/mendeleyImport.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/import/mendeley/mendeleyImport.js b/chrome/content/zotero/import/mendeley/mendeleyImport.js index 2d99e6d8e0..e931b83105 100644 --- a/chrome/content/zotero/import/mendeley/mendeleyImport.js +++ b/chrome/content/zotero/import/mendeley/mendeleyImport.js @@ -708,7 +708,8 @@ Zotero_Import_Mendeley.prototype._getDocumentFilesAPI = async function (document for (let file of (doc.files || [])) { var fileName = Zotero.File.truncateFileName(Zotero.File.getValidFileName(file.file_name || 'file'), 255); // most filesystems limit filename to 255 characters var tmpFile = OS.Path.join(Zotero.getTempDirectory().path, `m-api-${this.timestamp}-${file.id}`, fileName); - if (tmpFile.length >= 260) { + // Limit path length on Windows + if (Zotero.isWin && tmpFile.length >= 260) { const surplus = tmpFile.length - 260; if (surplus >= fileName.length) { Zotero.logError(`File ${fileName} will be skipped due to path exceeding filesystem limits: ${tmpFile}`);