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
using Bukdu
routes() do# correct wayplug(Plug.Static, at="/static", from=normpath(joinpath(pwd(),".")))
# wrong - not able to read from subdirs but able to get from current directory only# error in "from" value. For any requested file from subdir, the error 404 is generated.plug(Plug.Static, at="/static2", from=pwd())
# eating symbols from the file name# double slash in front of "at"-value gives an exception as a resultplug(Plug.Static, at="//static3", from=pwd())
end
Bukdu.start(8080)
The text was updated successfully, but these errors were encountered:
If I understand right, the from directory must contain . final symbol. That is unclear.
When the path contains a double slash then file names are interpreted without a first symbol. E.g. plug(Plug.Static, at="//static3", from=pwd()) gives an error while requesting "index.html" => /static3/ndex.html without i. Double slash might be occurring when the path was built from multiple strings with partial paths. Anyway that is not an error.
Sorry, my suggestion about the . sign was wrong. When normpath() is gettign something ended by /., the result is ended by /. That is, to fix the issue with from just add inside the code normpath(joinpath(normpath(path), ".")) to avoid confusion. Internal normpath() will remove dot if present. Next joinpath will guarantee that the path contains .. And final normpath gives a path that is always ended by /.
To fix the second issue, either change the calculation of the offset, or add replace(uri_path, r"/{2,}" => '/') inside.
Plug.Static is not providing proper errors.
The text was updated successfully, but these errors were encountered: