openlibhums / janeway

A web-based platform for publishing journals, preprints, conference proceedings, and books
https://janeway.systems/
GNU Affero General Public License v3.0
172 stars 65 forks source link

Long file names result in upload failure #3105

Open alainna opened 2 years ago

alainna commented 2 years ago

Describe the bug During a preprint submission, uploading a file with a 130 character name results in an error:

Storage can not find an available filename for "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxxxxx._xxxx_xxxx-xxxxx-xxxxxxxxx-xxxxxxxx-xxx-xxx-xxxxxxxxxxx-xx-xxx-xxxx-xxxxxx_xxxxxx". Please make sure that the corresponding file field allows sufficient "max_length".

Original filename: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxxxxx._xxxx_xxxx-xxxxx-xxxxxxxxx-xxxxxxxx-xxx-xxx-xxxxxxxxxxx-xx-xxx-xxxx-xxxxxx_xxxxxx.pdf

Janeway version 1.4.2.1

To Reproduce Steps to reproduce the behavior:

  1. When submitting a preprint, upload a PDF with a very long filename
  2. See error

Expected behavior PDF would upload and be renamed to something more accessible (eg file ID)

ajrbyers commented 2 years ago

For clarification: this bug only occurs when a long file name has a . In the middle and the substring that would be the extension + the length of a UUID4 is greater than 100 characters.