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

UnboundLocalError: local variable ‘name’ referenced before assignment #43

Open
flavianmissi opened this issue Jul 14, 2015 · 1 comment

Comments

@flavianmissi
Copy link

I'm getting this error in my application every time I try to upload a file (0.2.2):

File "/django_filepicker/utils.py", line 62, in get_file
  file = File(tmp, name=name)
UnboundLocalError: local variable ‘name’ referenced before assignment

I suppose I am getting this because neither the X-File-Name nor Content-Disposition headers are being set by the application.
The thing is I'm not sure why, can you shed me a light?

Also, maybe that's something you wanna protect from, like having a default for the name variable maybe?

Thanks!

@Nykakin
Copy link
Contributor

Nykakin commented Jul 15, 2015

Both of these headers should be always present after sending a request to get a Filepicker asset. You can observe that using following command:

curl -i -X HEAD https://www.filepicker.io/api/file/DCL5K46FS3OIxb5iuKby

We followed your sugestion and added initialization of name variable to an empty string.

Can you describe what kind of file did you try to upload? Is this happening for every kind of file?

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

2 participants