addons icon indicating copy to clipboard operation
addons copied to clipboard

[Task]: JS Size Detection on Input Change for Versions/Attachments

Open chrstinalin opened this issue 1 year ago • 1 comments

Description

Follow up from #14835 --

Use some JS to trigger size detection when the file input is changed. In that, call setCustomValidity() with a custom message if the size is over the limit, and otherwise call it to reset it to '' if valid. The user would need to change the file if they want to continue. If going that route though, they'd probably also need to be able to clear the input completely to start over. @diox

Similarly modify attachment uploads to handle size detection in a similar manner.

Acceptance Criteria

  ### Milestones/checkpoints
  - [ ] setCustomValidity() is called on file change for version uploads.
  - [ ] setCustomValidity() is called on file change for attachment uploads.

Checks

  • [X] If I have identified that the work is specific to a repository, I have removed "repository:addons-server" or "repository:addons-frontend"

┆Issue is synchronized with this Jira Task

chrstinalin avatar Sep 23 '24 13:09 chrstinalin

Where possible I think we should use the occasion to remove any hardcoded values in strings and make that depend on the MAX_UPLOAD_SIZE setting created for attachment uploads.

diox avatar Sep 23 '24 14:09 diox

QA: When clicking submit on file uploads other than the upload add-on flow (upload source, activity attachment from https://github.com/mozilla/addons/issues/14999 / https://github.com/mozilla/addons/issues/14997) you should see an error message when submitting a form with a file over 210 MB. That message should be displayed before the actual upload goes through and should prevent submission until the file is changed.

Screenshot from 2024-09-25 15-17-39

diox avatar Sep 25 '24 13:09 diox

I get the error message for a .zip below 210 mb too, it's ~207mb (actually if I check file's properties it's 202mb)

at submission 207mb

207MB

Doesn't look good on the versions page: that's only with files of 200 mb +

versions page zip

Also -> I could upload 160 - 180 MB zip files. But I also got the "Uncompressed size is too large" error. later edit other tests : I could upload source code for 180MB plus tar.bz2 file at submission and from the versions page, same with a 164MB tar.gz file. 200+ mb tar.bz2 throws the limit message.

ioanarusiczki avatar Sep 30 '24 10:09 ioanarusiczki