-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File move fails with eCryptFS if filename too long #644
Comments
afaik kanji/hiragana take up to 3 bytes per character, while there are also some rare characters that use 4 bytes. Maybe something like this would be useful to determine to correct byte length (and let the user specify the byte length instead of character length in the settings) |
Did some testing - hope its ok that I don't make a PR for this, as I didn't add a way to configure the limit in the settings area - and got it to work with this: in my ( $fn, $path, $ext ) = fileparse( $filename, qr/\.[^.]*/ );
use bytes;
$fn = substr encode_utf8($fn), 0, 142 - length($ext) - length(".upload");
$fn = decode_utf8($fn, Encode::FB_QUIET);
$filename = $fn . $ext;
no bytes; and in use bytes;
$filename = substr encode_utf8($fn), 0, 142 - length($ext) - length(".upload");
$filename = decode_utf8($filename, Encode::FB_QUIET);
$filename = $filename . $ext;
no bytes; the 142 in the substr lines is my filename bytelimit, so that should be replaced with a configurable variable The encode/decode_utf8 functions require |
I think adding a configurable byte limit for downloaded files is probably too deep to make a setting -- I'd be inclined to just modify the current shortening functions to reduce the limit to 142, which is still plenty in most cases. |
LRR Version and OS
LRR Latest Nightly using Docker (on Synology DSM)
Bug Details
Using eCryptFS (which is used by Synology for encryption) limits the filenames to a specific limit (143 bytes, so max 143 ascii chars or less if using unicode chars).
As some archives from specific sites tend to have long filenames, moving the file from the temp directory within the docker container to the final path, which is mostly somewhere mapped to the host fs, fails.
Matching Logs
Screenshots
Windows UI language is in german, sorry for that, but that screenshot here just proves that the filename is too long
Additional stuff
There is already a line that shortens the filename in LANraragi::Model::Upload line 185
LANraragi/lib/LANraragi/Model/Upload.pm
Line 185 in 6135773
I don't know how much effort it is, but maybe it could be a good solution to add a setting for the filename to the archive settings, where the user can specify an own length limit that suits their system?
Also the shortening has to be added to uploaded archives, perhaps in LANraragi::Controller::Upload line 27?
LANraragi/lib/LANraragi/Controller/Upload.pm
Line 27 in 6135773
Not sure if this is the first location where the archive gets stored on the filesystem, if not the upload could fail earlier.
The text was updated successfully, but these errors were encountered: