Repository navigation
fix(assets): verify uploaded cosmetic size from the R2 listing - #114
Merged
Merged
Conversation
stat() reported 0 bytes for a 538-byte pack.json that the bucket listing showed was stored in full, so publishing an emote pack failed with a size mismatch. Read the size from list(), as the upload script already does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Publishing an emote pack failed with HTTP 500:
The write reported all 538 bytes, but
stat()on the object returned a size of 0. The upload script stored the same file under a probe key and read its size back from the bucket listing, which showed 538 bytes. So the object was stored in full, andstat()reported the wrong size.R2CosmeticAssetStoragenow reads the stored size fromlist({ prefix }), the same wayupload-cosmetic-asset.tsalready does. A mismatch, or an object missing from the listing, still deletes the object and fails the publish. A failed publish already deletes the files it uploaded.Earlier cosmetics published fine because they were mostly larger image files. This was the first upload of a small JSON file.
Verification
R2CosmeticAssetStoragetests:stat()reports 0.bun test: 691 pass, 0 fail.bun run lintandbun run build --noEmitare clean.