filepicker / filepicker-django

A django plugin to make integrating with Filepicker.io even easier
Other
93 stars 29 forks source link

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

Open flavianmissi opened 9 years ago

flavianmissi commented 9 years ago

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 commented 9 years ago

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?