fix incorrect asset size limit
Issue:
Fixes #4085
the upload size check in signS3 adds up every object under the user's S3 prefix, including files that aren't referenced by any project. those leftovers don't appear in "My Assets" and the user has no way to delete them, so people get blocked by storage they can't even see. in the issue the account shows ~68MB in My Assets but uploads are rejected against the 250MB limit.
Demo:
no UI change (server-side size calculation). before: upload rejected even though My Assets is well under the limit. after: the limit is checked against the same assets shown in My Assets, so the upload goes through.
Changes:
- in
listObjectsInS3ForUser(server/controllers/aws.controller.js), an asset's size is only added tototalSizewhen it's actually referenced by a project (moved thetotalSize +=inside the existingwasMatchedcheck). - this makes the limit in
signS3match what's shown in My Assets. - added a unit test covering that orphaned objects are excluded from the total while referenced ones are counted.
- kept it scoped to the size calculation. cleaning up the orphaned files on the delete paths is a separate, already-in-progress effort, so it's intentionally out of scope here.
I have verified that this pull request:
- [x] has no linting errors (
npm run lint) - [x] has no test errors (
npm run test) - [x] has no typecheck errors (
npm run typecheck) - [x] is from a uniquely-named feature branch and is up to date with the
developbranch. - [x] is descriptively named and links to an issue number, i.e.
Fixes #123 - [x] meets the standards outlined in the accessibility guidelines
good morning! opened this for the asset size limit fix (#4085), would love a review whenever you get a chance @ksen0 @raclim
@Nixxx19 Thank you for the PR! I’m currently assigned to work on asset and S3-related issues and there are multiple smaller issues that I’m tackling systematically. I expect all of them to be addressed by mid-June. Since this PR may overlap with the changes I’m already working on, I’d suggest checking back after that if any related issues still remain. Thanks again for your contribution and understanding.