Skip to content

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

Merged
tsegismont merged 1 commit into
vert-x3:5.0from
tsegismont:backport-2902
May 22, 2026
Merged

Use decoded file path as cache key in StaticHandlerImpl#2905
tsegismont merged 1 commit into
vert-x3:5.0from
tsegismont:backport-2902

Conversation

@tsegismont

Copy link
Copy Markdown
Member

Backport #2902

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 added this to the 5.0.13 milestone May 22, 2026
@tsegismont
tsegismont merged commit 3c55076 into vert-x3:5.0 May 22, 2026
7 checks passed
@tsegismont
tsegismont deleted the backport-2902 branch May 22, 2026 15:15
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