Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed Clean data when uploading file as form-data #125

Open
joeldhenry opened this issue Nov 4, 2018 · 2 comments
Open

Failed Clean data when uploading file as form-data #125

joeldhenry opened this issue Nov 4, 2018 · 2 comments

Comments

@joeldhenry
Copy link

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
@rnegron
Copy link
Contributor

rnegron commented Nov 17, 2018

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.

@josefkorbel
Copy link

Also facing this issue while serving audio files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants