Skip to content

Use decoded file path as cache key in StaticHandlerImpl - #2902

Merged
tsegismont merged 1 commit into
vert-x3:masterfrom
tsegismont:single-fs-prop-entry
May 22, 2026
Merged

Use decoded file path as cache key in StaticHandlerImpl#2902
tsegismont merged 1 commit into
vert-x3:masterfrom
tsegismont:single-fs-prop-entry

Conversation

@tsegismont

Copy link
Copy Markdown
Member

Follows-up on #2900

After moving URI decoding into getFile(), sendStatic() was using context.normalizedPath() (which may still contain percent-encoded characters) as the cache key. Requests for the same file with different encodings (e.g. /foo/%62ar.txt vs /foo/bar.txt) created separate cache entries, wasting slots in the bounded LRU cache.

Use the decoded file path from getFile() as the cache key so that encoding-equivalent paths share a single entry.

As a side effect, getFile() is now called unconditionally at the top of sendStatic(), which simplifies the code. Previously, it was deferred when includeHidden was true (skipping the dot-segment check), requiring a null guard and a second getFile() call for the localFile computation.

Some portions of this content were created with the assistance of Claude Code.

Follows-up on vert-x3#2900

After moving URI decoding into getFile(), sendStatic() was using context.normalizedPath() (which may still contain percent-encoded characters) as the cache key.
Requests for the same file with different encodings (e.g. /foo/%62ar.txt vs /foo/bar.txt) created separate cache entries, wasting slots in the bounded LRU cache.

Use the decoded file path from getFile() as the cache key so that encoding-equivalent paths share a single entry.

As a side effect, getFile() is now called unconditionally at the top of sendStatic(), which simplifies the code.
Previously, it was deferred when includeHidden was true (skipping the dot-segment check), requiring a null guard and a second getFile() call for the localFile computation.

Some portions of this content were created with the assistance of Claude Code.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
@tsegismont
tsegismont merged commit c036ae3 into vert-x3:master May 22, 2026
8 checks passed
@tsegismont
tsegismont deleted the single-fs-prop-entry branch May 22, 2026 13:37
@tsegismont tsegismont added this to the 5.1.0 milestone May 22, 2026
tsegismont added a commit that referenced this pull request May 22, 2026
Follows-up on #2900

After moving URI decoding into getFile(), sendStatic() was using context.normalizedPath() (which may still contain percent-encoded characters) as the cache key.
Requests for the same file with different encodings (e.g. /foo/%62ar.txt vs /foo/bar.txt) created separate cache entries, wasting slots in the bounded LRU cache.

Use the decoded file path from getFile() as the cache key so that encoding-equivalent paths share a single entry.

As a side effect, getFile() is now called unconditionally at the top of sendStatic(), which simplifies the code.
Previously, it was deferred when includeHidden was true (skipping the dot-segment check), requiring a null guard and a second getFile() call for the localFile computation.

Some portions of this content were created with the assistance of Claude Code.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont added a commit that referenced this pull request May 22, 2026
Follows-up on #2900

After moving URI decoding into getFile(), sendStatic() was using context.normalizedPath() (which may still contain percent-encoded characters) as the cache key.
Requests for the same file with different encodings (e.g. /foo/%62ar.txt vs /foo/bar.txt) created separate cache entries, wasting slots in the bounded LRU cache.

Use the decoded file path from getFile() as the cache key so that encoding-equivalent paths share a single entry.

As a side effect, getFile() is now called unconditionally at the top of sendStatic(), which simplifies the code.
Previously, it was deferred when includeHidden was true (skipping the dot-segment check), requiring a null guard and a second getFile() call for the localFile computation.

Some portions of this content were created with the assistance of Claude Code.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant