[issue29020] collapse_rfc2231_value has inconsistent unquoting

bpoaugust report at bugs.python.org
Sat Dec 24 05:41:01 EST 2016


bpoaugust added the comment:

Another case is get_filename.

The second call to unquote will only change the incoming parameter if the original value was enclosed in <> or "". This is not a common scenario, and was only discovered because a mailer used the form <<<abcd>>> as a boundary marker (yes, this is invalid). So existing tests are unlikely to notice any difference.

Note that it is wrong to unquote more times than the original value has been quoted. So the only possible reason for keeping unquote in the function is if unquote has not already been called on a quoted value. (It is not possible to tell from the parameter whether or not it is currently quoted).

The two sample callers are get_boundary and get_filename.
Both pass the value already unquoted.

This method should be fixed to remove the unquote calls.
If there is a caller (is there one?) that does not unquote the value first, then that needs to be fixed as well.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29020>
_______________________________________


More information about the Python-bugs-list mailing list