View Issue Details

IDProjectCategoryView StatusLast Update
0029144mantisbtattachmentspublic2021-10-15 12:55
Reporterjensberke Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Product Version2.24.2 
Target Version2.25.3 
Summary0029144: Adding an attachment with a long filename causes "Data too long for column 'filename'" application error
Description

Column "filename" in "mantis_bug_file_table" has, as some other columns in this table, a limit of 250 characters. Uploading a file a file name longer than this limit results in the following error:

APPLICATION ERROR 0000401

Database query failed. Error received from database was #1406: Data too long for column 'filename' at row 1 for the query: INSERT INTO mantis_bug_file_table
( bug_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, user_id, bugnote_id, content )
VALUES
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ).
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

Steps To Reproduce

Create a file with the following file name, which has 255 characters, and add some arbitrary content to the file:

12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901.txt

Upload the file and click "Add note": the error appears.

Additional Information

Filenames with such a length are probably not very widespread if the files are created manually, but here's a use case where it can happen "semi-automatically": when you use the EmailReporting plugin in Mantis:

I receive an email from someone with a subject containing more than 250 characters.
I forward the email to the email address used for the EmailReporting plugin.
While doing so, the email client attaches contents of the original email I received as an attachment using the filename "[VERY LONG SUBJECT].eml", which will be too long for Mantis.
EmailReporting fetches the email, creates the ticket, tries to import this attachment and results in the error mentioned above.

In this use case, there's also a consequential error: the ticket was created (without the attachment), but the imported email will stay on the mail server because of the error. EmailReporting will fetch the email again next time, and the same circle starts again, endlessly. But that's probably something for the EmailReporting plugin to fix.

TagsNo tags attached.

Relationships

related to 0029148 resolvedSL-Gundam Plugin - EmailReporting Attachments with long filenames crash the import and new tickets for the same email weill be created in an endless loop 

Activities

dregad

dregad

2021-10-06 12:24

developer   ~0065891

Bug is confirmed.

In this use case, there's also a consequential error: the ticket was created (without the attachment), but the imported email will stay on the mail server because of the error. EmailReporting will fetch the email again next time, and the same circle starts again, endlessly. But that's probably something for the EmailReporting plugin to fix.

Indeed, nothing we can do about that. If you have not done so already, you should report the issue with them.

I would also suggest, that they use a different naming strategy for the attachment name - it does not really make sense IMO to generate such long file names.

jensberke

jensberke

2021-10-07 03:43

reporter   ~0065894

Ok thanks. I reported the consequential error in the EmailReporting project as 0029148

SL-Gundam

SL-Gundam

2021-10-07 04:20

reporter   ~0065895

@dregad. EmailReporting is not the one generating the filenames. It's the filenames of the attachments in the email and EmailReporting is using that as a base. We are going to trim the filenames as necessary.

dregad

dregad

2021-10-15 12:55

developer   ~0065918

PR https://github.com/mantisbt/mantisbt/pull/1782