-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webmail: recognize q/b-word-encoded filenames in attachments in messages
according to the rfc's (2231, and 2047), non-ascii filenames in content-type and content-disposition headers should be encoded like this: Content-Type: text/plain; name*=utf-8''hi%E2%98%BA.txt Content-Disposition: attachment; filename*=utf-8''hi%E2%98%BA.txt and that is what the Go standard library mime.ParseMediaType and mime.FormatMediaType parse and generate. this is what thunderbird sends: Content-Type: text/plain; charset=UTF-8; name="=?UTF-8?B?aGnimLoudHh0?=" Content-Disposition: attachment; filename*=UTF-8''%68%69%E2%98%BA%2E%74%78%74 (thunderbird will also correctly split long filenames over multiple parameters, named "filename*0*", "filename*1*", etc.) this is what gmail sends: Content-Type: text/plain; charset="US-ASCII"; name="=?UTF-8?B?aGnimLoudHh0?=" Content-Disposition: attachment; filename="=?UTF-8?B?aGnimLoudHh0?=" i cannot find where the q/b-word encoded values in "name" and "filename" are allowed. until that time, we try parsing them unless in pedantic mode. we didn't generate correctly encoded filenames yet, this commit also fixes that. for issue #82 by mattfbacon, thanks for reporting!
- Loading branch information
Showing
4 changed files
with
74 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters