You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
Describe the bug
Sirv does not serve files with spaces when using express, instead you get a 404. This issue exists with [email protected] or later.
To Reproduce
In the current template, exchange polka with express
create ./static/foo bar.txt
try to access /foo%20bar.txt in the browser
Expected behavior
I know that filenames containing spaces and other special characters are not best practice. However, you run into them anywhere and I would not expect sapper to just show a 404 without any further info.
Severity
I know about it and fixed it myself. However, that took me some time and either
the template should be changed so that both polka and express work out of the box
or
there should be a notice about this behaviour that prevents other users from running into the same issue.
My workaround: (maybe this could be integrated in the template with a switch "express used")
// server.jsexpress().use(compression({threshold: 0}),(req,res,next)=>{// pass sirv a decoded urlsirv("static",{ dev }).call(null,{ ...req,path: decodeURIComponent(req.path)},res,next);},sirv("static",{ dev }),sapper.middleware())
The text was updated successfully, but these errors were encountered:
konnextv
changed the title
Sirv does not serve files with spaces when using express
Sirv does not serve files with space in filename when using express
Sep 13, 2020
Describe the bug
Sirv does not serve files with spaces when using express, instead you get a 404. This issue exists with [email protected] or later.
To Reproduce
./static/foo bar.txt
/foo%20bar.txt
in the browserExpected behavior
I know that filenames containing spaces and other special characters are not best practice. However, you run into them anywhere and I would not expect sapper to just show a 404 without any further info.
Severity
I know about it and fixed it myself. However, that took me some time and either
or
Additional context
Issue at sirv: URLs not correctly parsed for ^1.0.0 with express
My workaround: (maybe this could be integrated in the template with a switch "express used")
The text was updated successfully, but these errors were encountered: