-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
First of all, many thanks for ripmime!
I sometimes encounter files containing attachments with very long filenames. "Very long" means longer than 255 characters (on my Linux system). This is an error message I recently got:
mime.c:2337:MIME_generate_multiple_hardlink_filenames:WARNING: While trying to create '(...)' link to '(...)' (File name too long)
On non Linux filesystems (HFS, FAT, ...) the maximum filename length can even be less than 255 characters.
Suggestion for handling the problem:
- Query the max. file name size with the help of function pathconf (see http://www.gnu.org/software/libc/manual/html_node/Pathconf.html, parameter _PC_NAME_MAX)
- If a file is to be created with a name longer than that value: Shorten the filename to the max value minus some spare characters.
- Those spare characters are needed if a file with that name already exists. In that case, renaming could be done according to the options --overwrite, --unique-names, --prefix, --postfix and --infix.
- Optionally, the spare characters could include some string hinting that the filename was shortened and does not correspond to the original filename. For example: "AttachmentThatReallyHasSomeVeryLongFilename" would become "AttachmentThatReallyHasSomeVe_shortened".
- If a filename needs to be shortened, ripmime could inform about it on stdout (the message would include the original filename) .
- ripmime could even refuse to work on file systems whose maximum filename length is less then a certain value.
Thanks again for this great tool and best greetings!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels