Only wrap attachment filenames in double quotes not other params #481

Merged
merged 1 commit into from Jan 23, 2013

Conversation

Projects
None yet
2 participants
@bpot
Contributor

bpot commented Dec 20, 2012

The current implementation is sticking quotes in odd places:

1.9.3p194 :018 > Mail::ContentTypeField.new.send(:ensure_filename_quoted, "audio/x-midi;\r\n\sname=Part .exe")
 => "\"audio/x-midi;\r\"\n name=\"Part .exe\""

After the fix:

1.9.3p194 :002 > Mail::ContentTypeField.new.send(:ensure_filename_quoted, "audio/x-midi;\r\n\sname=Part .exe")
 => "audio/x-midi;\r\n name=\"Part .exe\"" 

Not super thrilled with the nasty regexp, open to other ways of solving this problem.

@jeremy

This comment has been minimized.

Show comment
Hide comment
@jeremy

jeremy Jan 19, 2013

Collaborator

Nice regexp-fu. It is pretty awkward have to quote an attribute value within the full field value before parsing. An alternative is to make the parser more liberal so it can cope with poorly-quoted attribute values.

Collaborator

jeremy commented Jan 19, 2013

Nice regexp-fu. It is pretty awkward have to quote an attribute value within the full field value before parsing. An alternative is to make the parser more liberal so it can cope with poorly-quoted attribute values.

jeremy added a commit that referenced this pull request Jan 23, 2013

Merge pull request #481 from bpot/ensure_filename
Only wrap attachment filenames in double quotes not other params

@jeremy jeremy merged commit 8925d37 into mikel:master Jan 23, 2013

jeremy added a commit that referenced this pull request Jan 23, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment