From 53e5abc6cbe0b1e8ddf78eee00cea6b521aaeaa2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 6 Aug 2019 06:52:35 -0400 Subject: [PATCH] Maybe fix NS_ERROR_FILE_NAME_TOO_LONG sync error on eCryptfs on Linux When the filename limit isn't 255 on Linux, it's probably because of eCryptfs, but we were checking the character length instead of the byte length before shortening the filename to 143 bytes. --- chrome/content/zotero/xpcom/file.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js index 3599f02373..72c6647c82 100644 --- a/chrome/content/zotero/xpcom/file.js +++ b/chrome/content/zotero/xpcom/file.js @@ -915,7 +915,9 @@ Zotero.File = new function(){ } catch (e) { // On Linux, try 143, which is the max filename length with eCryptfs - if (e.name == "NS_ERROR_FILE_NAME_TOO_LONG" && Zotero.isLinux && uniqueFile.leafName.length > 143) { + if (e.name == "NS_ERROR_FILE_NAME_TOO_LONG" + && Zotero.isLinux + && Zotero.Utilities.Internal.byteLength(uniqueFile.leafName) > 143) { Zotero.debug("Trying shorter filename in case of filesystem encryption", 2); maxBytes = 143; continue;