﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32329	CSRF failure incorrectly reported on upload when there is a problem with storage	IO	Virtosu Bogdan	"Minimal reproduction app is in the attachment, although the only changes from the default template are:
csrfbug/settings.py:
{{{
MEDIA_URL = '/media/'
MEDIA_ROOT = 'media/'
FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024
FILE_UPLOAD_TEMP_DIR = MEDIA_ROOT + 'tmp'
}}}
app/models.py
{{{
class File(models.Model):
    file = models.FileField()
}}}
app/admin.py
{{{
from .models import File
admin.site.register(File)
}}}

== Required setup for the attached app:
{{{
python manage.py migrate
python manage.py createsuperuser
}}}

== Steps to reproduce
1) runserver
2) navigate and login to /admin/
3) navigate to /admin/app/file/add/

Scenario 1. default state - file uploads works as expected
Scenario 2. remove media/tmp directory - file uploads works only for files that fit in FILE_UPLOAD_MAX_MEMORY_SIZE, error otherwise (see below)
Scenario 3. remove whole media directory - error reported for all file uploads (see below)

== Exact error message:
Forbidden (403)
CSRF verification failed. Request aborted.
Reason given for failure: CSRF token missing or incorrect.

== Expected behaviour:
Filesystem error or similar reporting incorrect media storage setup. 

== Comment:
Yes, the setup in this scenario is invalid to begin with, but the error message has nothing to do with the actual problem. 
I suspect a real problem with an underlying filesystem will also get covered in the same way."	Bug	closed	CSRF	3.1	Normal	fixed	uploads csrf admin		Ready for checkin	1	0	0	0	0	0
