Compress source paths and shorten URL signatures - #9
Merged
Merged
Conversation
Resize-route source paths were the last uncompressed URL segment. They now go through UrlCodec::compressSourcePath, which emits the shortest of three deterministic forms: plain rawurlencoded segments, a dictionary token for the directory part with the filename kept plain (visible for image SEO), or a token for the whole path. S3 bucket names cannot start with '_', so the token prefix is unambiguous against legacy paths and old URLs keep decoding unchanged. Signatures shrink from 32 hex chars to 22 by encoding the same md5 digest as unpadded url-safe base64. The image service accepts both encodings, but must deploy its decoder first (image-service-lambda "Decode compressed source paths" PR) before this version is released. Measured on production-shaped paths this cuts resize URLs by 20-30%. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Resize-route source paths were the last uncompressed URL segment. This finishes the job started in #8.
What changed
UrlCodec::compressSourcePath()emits the shortest of three deterministic forms: plain rawurlencoded segments, a dictionary token for the directory part with the filename kept plain (visible for image SEO), or a token for the whole path. S3 bucket names cannot start with_, so the token prefix is unambiguous against legacy paths — published URLs keep decoding unchanged.Measured on production-shaped paths with the frozen v1 dictionary:
bucket/file.jpgOverall resize URLs come out 20–30% shorter. Template-route URLs only get the shorter signature (payload + params were already compressed; the SEO filename stays plain by design).
Rollout order
Verification
%,+, spaces)🤖 Generated with Claude Code