Repository navigation
Conversation
|
|
No, I doubt it will change that If I get a chance later I can hardcode an error in this block locally to confirm that Vite handles it |
|
I was curious and tested the hardcoded error you mentioned to try in the vite block itself. It seems it moves the error from just the browser to the browser and server (which seems better?). Other errors through Svelte files etc are unaffected. I'm in favour of this. |
|
awesome. thanks! |
Fixes #17650 The dev asset middleware decodes every request pathname before deciding whether it names a static asset. Invalid percent escapes therefore throw before application routing and become Vite 500 error responses, including for malformed image URLs such as `/%%7BimgPath%7D`. The early asset handler introduced in #5686 remains necessary to keep public assets out of Vite's transform middleware. #12762 removed its broad catch because Vite already handles unexpected errors; restoring that catch, or copying the later handler's catch, would still produce a 500. Catch only pathname decoding failures and return a small 400 response before continuing through the middleware chain. This also prevents these invalid paths from reaching the later dev decoder. URL parsing, filesystem failures, asset serving, case checks, and base-path handling retain their existing behavior. Preview already guards decoding and falls through to the runtime's malformed-URI handling, so it needs no change. Unlike a forgiving decoder or broad middleware catch, this does not pass malformed paths downstream or misclassify genuine server errors as client errors. The behavior covers document and subresource requests while preserving valid encoded paths and percent escapes in query strings. - [Ported reproduction](https://www.sveltelab.dev/#code=N4IgzgTgxiBcoBMCWECmUAuB7CBPOoAhgA7EB0AFhgLYA2BIAZkrag1FgHYardhwgAPAEIEWTLmKoABFToA%2BADqdBc2tNqFOAcwC8ikLwNLOijKtSEEJs2cHVUGQtKgVCEMI-0gArhkYAtAAcBtIA9DYYdg5O0pyEDt4AbkioAO7EOFEgLlw83N5pSAgYFLoIqClQqAFFJRQANNJInEgYSIS0AWBQnai6AIyhEcq25jHO8YkGPAAeGN29rKEc3LwY3j19w5FmAKRgSai0PADWbZSWCHuj5mEUV5GCAEZYCLjSCIRO3UcnqOcFsQ0LQsFYAl8nN4KFgjhBjLc7MgktIwBhcKxvMgwMRNLhYLk1nxjAc-mcLq93ntBGFkU8wpTcCYaWoTCAAL7shogCBYPyofjwEDINCYHD4IUAajxfIwZEOxx4DGYrHYeXWg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ldBvL-xMyfbMc1z0bKIfWR2lD-yTT6F8BoG188CLbQwhKyfq0ByVo34VGYJwVAABhRGj0v7%2BiDMAqsyhs5HzKowTmJxMEtFgfA0szcVZq0bgSEerkGaAkIbTHGldiDVzru0LgYA8o0LMAZaBLDpCEN9PRDi3pyz5l2O7Da04OLylxG0UsYQh5hEUPIxQ88wjljIC0KA-cKhlkDJwN4qAAD6lkEDWUjIIgA-NIHw5NUBQNQAgaQBIu6cUqhgTKphnF3zPgSDxEAKzRXZOWW4i9o6VkIpyIAA) — request `/%%7BimgPath%7D` while running in dev mode. <!-- svelte-triage-bot:feedback-baseline:af9ba601bc93d4df09052edff9fb18620dd9bd85 --> --------- Co-authored-by: svelte-triage-bot <[email protected]> Co-authored-by: Tee Ming <[email protected]>



Vite should handle an error here, so we shouldn't need our own handling