Last 12 weeks · 0 commits
2 of 6 standards met
Summary preserve the original query string for serve-handler's automatic redirects limit the behavior change to and redirects add integration coverage for both redirect paths Problem Requests such as currently redirect to , dropping the original query string. The same thing happens for automatic trailing slash redirects. Scope This patch keeps the change narrow on purpose: it preserves the query string only for redirects generated internally by and . It does not change the behavior of user-configured . Testing Fixes #178
Problem I ran into this while using the Docusaurus command (which uses under the hood) to preview a built Docusaurus site. The site has versioned docs at URLs like , where is a directory on disk () — not a file with an extension. returns (non-empty), so treats the path as a file request and runs the early optimization. That call succeeds — because is a real directory. Since is now set, the block is skipped, and never runs to look up inside the directory. With , returns empty, is cleared, and the response is a 404 — even though exists. Concretely:** a build output like this: returns 404 when served with: Fix After the early , if the resolved path turns out to be a directory, clear so runs and can fall back to (or a sibling): Affected configuration Reproduces when all of the following are true: The requested path's final segment contains a dot (e.g. , ) Tests Added fixtures and four new test cases covering the affected scenarios:
Repository: vercel/serve-handler. Description: The foundation of `serve` Stars: 618, Forks: 116. Primary language: JavaScript. Languages: JavaScript (88.2%), EJS (11.8%). License: MIT. Homepage: https://npmjs.com/serve-handler Topics: handler, middleware, server, single-page-applications, static. Latest release: 6.1.7 (5mo ago). Open PRs: 38, open issues: 48. Last activity: 3mo ago. Community health: 50%. Top contributors: leo, AndyBitz, TooTallNate, dependabot[bot], thasophearak, wellingguzman, kachkaev, andyburke, AxlLind, balupton and others.