Opened 4 years ago

Last modified 4 years ago

#32413 closed Bug

File upload permission denied error on large files — at Version 1

Reported by: James Miller Owned by: nobody
Component: File uploads/storage Version: 3.1
Severity: Normal Keywords:
Cc: René Fleschenberg Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by James Miller)

Hi, if an uploaded file exceeds the DATA_UPLOAD_MAX_MEMORY_SIZE of 2.5 mb, django starts streaming the file data to a file in /tmp.

When finished it copies it over to the its required file path location, but despite the permissions being set correctly, a permission denied error occurs.

Request Method: 	POST
Request URL: 	http://127.0.0.1:8000/xxxx/upload/
Django Version: 	3.1.5
Exception Type: 	PermissionError
Exception Value: 	

[Errno 13] Permission denied: '/opt/django_forum/django_forum/media/uploads/users/xxxxx/Albert_Memorial_London_-_May_2008_vWcDQT6.jpg'

Exception Location: 	/usr/local/lib/python3.9/shutil.py, line 329, in _copyxattr
Python Executable: 	/usr/local/bin/python
Python Version: 	3.9.1
Python Path: 	

['/opt/django_forum/django_forum',
 '/opt/django_forum/django_forum',
 '/etc/opt/django_forum',
 '/opt/django_forum',
 '/usr/local/lib/python39.zip',
 '/usr/local/lib/python3.9',
 '/usr/local/lib/python3.9/lib-dynload',
 '/usr/local/lib/python3.9/site-packages']

I have tried setting the following settings:

FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o755
FILE_UPLOAD_PERMISSIONS = 0o644

Most disturbingly, the large files are created in their final position with 0755 permissions.

I am using a containerised workflow as opposed to a venv but I am not certain that that should cause any issues.

Change History (1)

comment:1 by James Miller, 4 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top