Opened 10 years ago

Closed 10 years ago

#22706 closed Bug (duplicate)

Debug error is not working fine when filepath is bad

Reported by: gox21mx@… Owned by: nobody
Component: File uploads/storage Version: 1.6
Severity: Normal Keywords: Debug
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Write an upload_to_function that overrides the upload_to on models. Use MEDIA_ROOT/modelname/file.ext for that, on settings.py remove tha last slash (/) from MEDIA_ROOT.

Write a model that have a field that have upload_to=upload_to_function

It will cause that the complete url seems like:

/MEDIA_ROOTmodelname/file.ext #clearly you see there is a slash (/) missing.

Go to the admin and try to add a new object for the model that calls to upload_to_function you created

on django 1.3 you'll got:

SuspiciousOperation at /admin/app/model/add/
Attemped access to '/BASE_PATH/mediafolderfile.ext' denied

on django 1.6.5 you'll got
Bad Request (400)

Definitively it is impossible to figure out what is causing the error on django 1.6.5

Attachments (2)

error1_3.jpg (21.1 KB ) - added by gox21mx@… 10 years ago.
Error caugh on django 1.3
error1_6.jpg (5.2 KB ) - added by gox21mx@… 10 years ago.
Error caugh on django 1.6

Download all attachments as: .zip

Change History (3)

by gox21mx@…, 10 years ago

Attachment: error1_3.jpg added

Error caugh on django 1.3

by gox21mx@…, 10 years ago

Attachment: error1_6.jpg added

Error caugh on django 1.6

comment:1 by Tim Graham, 10 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #21668. I've made a note of your experience there, thanks.

Note: See TracTickets for help on using tickets.
Back to Top