boto/boto — pull request #646 by jonny5532 (2012-03-19 11:58:00+00:00)
Title: Parameter escaping fix for auth_path generation in boto.s3.connection.generate_url

The auth_path value generated inside boto.s3.connection.generate_url (and subsequently fed to boto.utils.canonical_string) is made up from unescaped key=value pairs joined by ampersands. If one of values contains a filename with an ampersand in (for the response-content-disposition, for example), canonical_string truncates that value and the routine results in an incorrect signature.

Since canonical_string urllib.unquotes the values internally, it makes sense to urllib.quote them before passing them in so the value is not truncated on unescaped ampersands.

The resulting behaviour works - Amazon is happy with the signature and the file downloads with the correct filename (inclusive of ampersands).