-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Zip Files to be Uploaded as Attachment #22670
Conversation
I did notice that uploading over the client_max_body_size will cause a 413. Now that I think about it more, it's probably better to avoid that situation altogether and check the size using JS similar to submitting a new add-on rather than arbitrarily increasing the limit |
Yes, that would be ideal. Doesn't have to be as fancy, but that would be a nice little quality of life feature. |
static/js/zamboni/reviewers.js
Outdated
) | ||
) | ||
$('#attachment_errors').append(error); | ||
$(this).val(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love automatically clearing the input (the user might not realize that has happened) but it's fine as the first iteration. For later, I've added a suggestion to mozilla/addons#14835 (comment) we could re-apply here as well, but don't worry about it now.
static/js/zamboni/reviewers.js
Outdated
.append( | ||
$('<li>').append( | ||
format(gettext('Your file exceeds the maximum size of {0}.'), [ | ||
'200MB', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have to hardcode this:
Intl.NumberFormat(document.documentElement.lang, {
notation: 'compact',
style: 'unit',
unit: 'byte',
unitDisplay: 'narrow',
}).format(max_upload_size);
(It gives 210MB because it's using SI units but that's fine)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be confusing for a 208MB file to reject with this error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already works actually - I think our python code is using SI units, so your patch already allows 210MB (200 MiB) files server-side.
Template for approvals/rejections should also mention any attachments. |
Fixes: mozilla/addons#14999
Description
Builds on #22640 to allow .zip files to be uploaded as attachment.
Note: The local nginx configuration fails for large files. There's an issue filed for this here. To test this feature locally, two lines in
addons.conf
need to be changed --try_files $uri @frontendamo;
->try_files $uri @olympia;
client_max_body_size 50m;
->client_max_body_size 500m;
(or anything else bigger than 200mb)Testing
enable-activity-log-attachments
waffle switch.Checklist
#ISSUENUM
at the top of your PR to an existing open issue in the mozilla/addons repository.