Page 1 of 1

MIME decode: Content-Type ext for other unnamed parts

Posted: 2018-06-12, 16:30 UTC
by Usher
ghisler(Author) wrote:30.05.18 Release Total Commander 9.20 beta 5 (32/64)
(...)
29.05.18 Added: Decoding of MIME files where the name wasn't given -> use .txt extension for TEXT/PLAIN fields, and .htm for TEXT/HTML instead of .bin (32/64)
I think it's also possible to use Content-Type declared for other MIME types, when dealing with unnamed files, f.e.
* Content-Type: image/jpeg – add jpeg extension
* Content-Type: text/css – add css extension
* Content-Type: application/epub+zip – add epub extension
etc.

Current list of media types is available at IANA site here: https://www.iana.org/assignments/media-types/media-types.xhtml

The list is very long and contains many exotic types so I don't think it should be fully supported. Some most common types (f.e. image/jpeg, image/png, image/gif) can be hardcoded like text/plain and text/html now, but the best solution is to keep media type list available for user editing.
It may be a separate list or a part of wincmd.ini, something like:

Code: Select all

[MediaTypes]
txt=text/plain
html=txt/html
jpeg=image/jpeg
png=image/png
epub=application/epub+zip
dat=unsupported
The last entry is extension for unsupported media types. I think it should be also user defined. TC uses bin here, but some popular email clients (f.e. MS Outlook, Outlook Express, Windows Mail/Live Mail) use (or used in the past) dat extension.

Posted: 2018-06-13, 17:26 UTC
by ghisler(Author)
I'm aware of that. But normally in e-mails just the text doesn't have a name, the attachments usually have one.

Posted: 2018-06-15, 20:01 UTC
by Usher
I think that people mostly don't use TC for decoding or viewing normal, standard-compliant emails. I'd rather expect using these features for spam or other suspicious messages. Such messages are usually generated automatically and don't conform internet standards, so they may contain unnamed parts.
There may be also "normal emails" – containing invoices, notifications, confirmations etc. generated automatically by lame corporation software. In such cases it may be difficult to recognize which email comes from real corpo and which one is spoofed and malicious.