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.
This commit is contained in:
Dan Stillman 2019-08-06 06:52:35 -04:00
parent f65c10b3e3
commit 53e5abc6cb

View file

@ -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;