drf-tracking icon indicating copy to clipboard operation
drf-tracking copied to clipboard

Failed Clean data when uploading file as form-data

Open joeldhenry opened this issue 6 years ago • 2 comments

UnicodeDecodeError
'utf-8' codec can't decode byte 0xff in position 400: invalid start byte

rest_framework_tracking/base_mixins.py in _clean_data at line 163

joeldhenry avatar Nov 04 '18 05:11 joeldhenry

It seems likely that the file you are trying to upload is encoded as UTF-16 or similar. In the _clean_data function, there is a line which tries to decode the incoming request data as UTF-8. That line is the cause of your issue.

I'm wondering what the best solution to fix this issue in the code is? Attempt to auto-detect encoding using chardet? Silently fail the data cleaning? Would be willing to implement a suggested solution.

rnegron avatar Nov 17 '18 21:11 rnegron

Also facing this issue while serving audio files.

josefkorbel avatar Nov 23 '18 12:11 josefkorbel