Files
Nikolay Tatarinov 47b81c8f22 Upgrade Nuxt version and update configuration
- Updated Nuxt from version 3.21.1 to 4.3.1 in package.json for improved features and performance.
- Removed outdated TypeScript error suppression in nuxt.config.ts for cleaner code.
- Updated README.md to reflect the transition to Nuxt 4 and added instructions for post-upgrade steps.
- Modified error handling in middleware to use consistent error property names.
2026-03-04 00:35:15 +03:00

13 lines
409 B
TypeScript

/**
* Reject requests with malformed URI before they reach Vite.
* Vite's static middleware calls decodeURI() and throws "URI malformed" on invalid sequences (e.g. %2: or %91).
*/
export default defineEventHandler((event) => {
const path = event.path ?? event.node.req.url ?? ''
try {
decodeURI(path)
} catch {
throw createError({ status: 400, statusText: 'Bad Request' })
}
})