Restrict the length attachment filenames on disk
|Assignee:||Jean-Philippe Lang||% Done:|
When uploading a file with a very long name, the
disk_filename might be too long to be stored on the server's filesystem.
Since Redmine always prepends the timestamp to the name of the uploaded file, the final
disk_filename will be longer than 255 characters (the common limit for filenames on most file systems) if the original filename is between 240 and 255 characters long. If that is the case, the attachment save will fail with a
Errno::ENAMETOOLONG exception when attempting to write the file to disk.
The attached patch by Planio fixes this behavior by restricting the length of the filename 50 characters (to have some breathing room on unusual file systems). In that case, we just use the ASCII fallback we already have in place.