reddec / trusted-cgi

Lightweight runner for lambda functions/apps in CGI like mode
https://trusted-cgi.reddec.net
MIT License
218 stars 16 forks source link

bugfix the (non)existence of a slash when staticFolder is set #27

Open coderofsalvation opened 6 months ago

coderofsalvation commented 6 months ago

so, as @reddec already expected the staticDir crashed when no trailing space existed in an URL. This fix handles all possible situations:

situation input output
without slash e87-ecf98-ecf998-ef98
with slash e87-ecf98-ecf998-ef98/
with slashes e87-ecf98-ecf998-ef98/foo/bar foo/bar

the first two scenarios will correctly fallback to serving index.html

reddec commented 6 months ago

@coderofsalvation thanks for the idea, I used it as basis in https://github.com/reddec/trusted-cgi/commit/d2e405cd37704d4c88b04c63eb8022d6f590c926 . Could you please confirm that it will solve your case?

coderofsalvation commented 6 months ago

yup that works! Btw. I've replaced/force-pushed this branch with another fix: it resolves index.html in any directory now (see commit) This seems to be the default behaviour on many static-file http servers.