mbraak/django-file-form

File permissions

jucajuca opened this issue · 4 comments

Hi,

I think the documentation should mention the following requirement in settings.py:

FILE_UPLOAD_PERMISSIONS = 0o644

Or mention that the django settings should be set: https://docs.djangoproject.com/en/3.1/ref/settings/#std:setting-FILE_UPLOAD_PERMISSIONS

Otherwise, the permissions will misbehave:

-rw-r--r-- 1 user user 358614 Jan 18 20:48 somefile_22.jpg
-rw-r--r-- 1 user user 1614623 Jan 19 12:58 somefile_2.jpg
-rw------- 1 user user 133716297 Jan 18 20:44 somefile_02.mp4
-rw------- 1 user user 56701376 Jan 19 10:18 somefile_00.mp4

I read in the documentation that the default is also 0o644. So that would mean that you can skip setting FILE_UPLOAD_PERMISSIONS, so the default is used.

Is that correct?

Yes, that is what the documentation says, however, the behaviour was not correct. Some files had the right permissions and some others didn't.

The documentation also mentions that the default was only introduced in django 3.0. I have a project running on 2.7, and the above problem appeared.

I just made a pull request.

Thanks! I will have a look at the pr.

I merged the pr.