Repository navigation
Keep Download all file names within the 255-byte limit - #435
Open
officialasishkumar wants to merge 1 commit into
Open
officialasishkumar wants to merge 1 commit into
officialasishkumar wants to merge 1 commit into
Conversation
Artifact names are capped at 180 characters, but most file systems cap a single file name at 255 bytes, and a character outside ASCII takes up to 4 bytes in UTF-8. A name of 176 Chinese characters plus ".txt" became a 532-byte ZIP entry, which unzip tools may refuse or shorten on their own. buildArtifactBundle now shortens each entry name to 255 UTF-8 bytes: - the cut lands between characters, never inside one; - the extension is kept, and so is a " (2)" style copy suffix, which is fitted before the stem is cut, so two names that shorten to the same text still get different entries; - an extension too long to keep beside a copy suffix is treated as part of the name, so the suffix always fits. Names already within the limit are unchanged. Fixes useagenthq#403
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.
By opening this pull request you agree to the Contributor License Agreement. On your first pull request a bot asks you to sign it with a one-line comment.
Fixes #403
Artifact names are capped at 180 characters, but most file systems cap one file name at 255 bytes, and a character outside ASCII takes up to 4 bytes in UTF-8.
buildArtifactBundlekept the name as it was, so a file named with 176 Chinese characters plus.txtbecame a 532-byte ZIP entry, which an unzip tool may refuse or shorten on its own.What changed
All code changes are in
packages/artifact-formats/src/index.ts:(2)is fitted first and the rest of the name is cut to make room, so two names that shorten to the same text still get two different entries. Real names are still reserved before any suffix is given out, as in Keep every file in Download all when names collide #400.Tests
Five new cases in
packages/artifact-formats/test/formats.test.ts:.txtbecomes 83 characters plus.txt(253 bytes)名×83.pdf,名×82 (2).pdfand名×82 (3).pdf, all within 255 bytes(2)within the limitThe first four fail on
main.End to end, I published two files through
artifact_publishon one run (文×176.txtand文×175字.txt, which are different names that shorten to the same text) and fetched the realGET /api/artifacts/runs/:runId/archiveroute. Reading the name lengths straight from the ZIP's central directory:文×83.txt(253 bytes),文×82(2).txt(254 bytes)This change has no visible UI, so the table is the before and after. The Download all button itself was not clicked in a browser.
Checks with Bun 1.3.14:
cd packages/artifact-formats && bun run test: 42 pass, 0 failcd packages/artifact-formats && bunx -p typescript@5.9.3 tsc --noEmit: passescd backend && bun test test/artifacts.test.ts(againstpgvector/pgvector:0.8.6-pg16-bookworm, with the package reinstalled): 40 pass, 0 failbun test scripts/agent-docs.test.ts: 5 passOpen in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.