Misago
Misago copied to clipboard
Attachment size limit permission not respected
It doesn't look like the attachment size limit that's modifiable in the user role permission settings isn't being respected. I may not be setting this right, but here's the settings:
Member role settings

Moderator role settings

My user roles

Error message I'm receiving

Is there another setting I'm missing?
Ah, it looks like there's a per-AttachmentType file size that may have higher priority over this setting, even though the AttachmentType option states:
May be overriden via user permission.
EDIT: I bumped the AttachmentType limit and now I'm able to upload larger images, so I guess the settings aren't being applied in the right order or something
It seems to be this line that's getting that setting: https://github.com/rafalp/Misago/blob/b16b5c6b726ca5e71cc5738e5d062d6c9d534b55/misago/threads/api/attachments.py#L32
Forgive me, I know nothing about ACL altogether, albeit in django 😁 This looks like it might be where the issue is occurring? https://github.com/rafalp/Misago/blob/b16b5c6b726ca5e71cc5738e5d062d6c9d534b55/misago/threads/permissions/attachments.py#L43-L58
Attachment type limit overrides uploads limit for individual types:
https://github.com/rafalp/Misago/blob/master/misago/threads/api/attachments.py#L32 https://github.com/rafalp/Misago/blob/master/misago/threads/api/attachments.py#L89
Huh, it looks like the request.user_acl["max_attachment_size"] is the first "hard limit" that's tested though:
https://github.com/rafalp/Misago/blob/master/misago/threads/api/attachments.py#L90
Where does that number come from? I had just assumed it was the group permissions
Can we use GITHUB public code on our website? Is there any copyright policy?
@emawalekr01
Misago is free and open source software. You can read license here: https://github.com/rafalp/Misago/blob/master/LICENSE.rst
Please ask on our support forums in future. Asking unrelated questions in other people issues is found rude on GitHub ;)
What's happening currently is there are two separate filesize checks:
- Check against user's upload limit, coming from their permissions
- Check against attachment type upload limit, coming from file type (if set)
So you can have user with permission to upload files that are 8mb in size, but file type they are uploading is limited to 2mb. You are uploading 4mb file. First check will pass but second check will fail.
I will remove support for per-type upload limits in 0.30 but keep fields around. I will drop them altogether 1.0 I think.