SG-34551 validation for python3, so display_name now is only decoded …#337
Conversation
…for python3 and python2 keeps working in same way
…nyother version with new code
julien-lang
left a comment
There was a problem hiding this comment.
Looks good. Are there any other fields that could have the same problem?
Also is it possible to add unit tests?
|
@julien-lang By the moment I couldn't see other fields with that potential problem in the scope of "_upload_to_sg" function because it is the only one field that previously was encoded to utf-8(encode("utf-8")) to assurance the behavior of non-ascii unicode and utf-8 string paths during upload. |
…se the flow than this ticket fix
| 'attachments', | ||
| tag_list="monkeys, everywhere, send, help" | ||
| ) | ||
| self.assertTrue(isinstance(upload_id, int)) |
There was a problem hiding this comment.
Do you have access to mock_send_form.call_args? I'm wondering if we can inspect if params["thumb_image"] and params["file"] values when calling _send_form are correct without unwanted prefix and suffix.
| if six.PY2: | ||
| display_name = os.path.basename(path) | ||
| else: | ||
| display_name = os.path.basename(path.decode("utf-8")) |
There was a problem hiding this comment.
Can you 15 lines above. There is a big comment about unicode path and we encode path in utf-8... Looks like the opposite of what's done here. We might want to refactor/clean/review all that
…overed with this deletion
Now prefix/suffix if display_name property exists is not added