nitro
nitro copied to clipboard
Improve error for invalid URLs
Environment
nitropack: 1.0.0 nuxt3: 1.0.0 node: node18
Reproduction
nuxt3
pnpm build
pnpm preview
Describe the bug
invalid url will cause 500 error, because new URL()
. It shoud be catch
exception and throw not match 404.
sample URl : http://localhost:3000/.%AE/WEB-INF/esp_ldap_context.property
https://github.com/unjs/nitro/blob/8e06f2e4a65c6de0d2f2f3a5ef156ae3821ed60a/src/runtime/static.ts#L18~L22
// runtime/static.ts
let id = decodeURIComponent(
withLeadingSlash(
withoutTrailingSlash(parseURL(event.node.req.url).pathname)
)
);
// [nuxt] [request error] [unhandled] [500] URI malformed
Additional context
No response
Logs
No response