New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest FS improvement breaks static routes #2117
Comments
I can confirm that this happens. It is limited to case when second parameter for
Lines 494 to 502 in 6b5e62b
Actually I'll look what we can do with |
Just to point out that serving single file with So if you have e.Static("", "./index.html") and for some odd reason that
with x@x:~/code/$ curl -v http://localhost:8080/.htpasswd
* Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /.htpass HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Content-Length: 4
< Content-Type: text/plain; charset=utf-8
< Last-Modified: Wed, 09 Mar 2022 18:27:46 GMT
< Date: Wed, 09 Mar 2022 18:29:15 GMT
<
hi
* Connection #0 to host localhost left intact |
Thanks for clarifying! I'll definitely use Edit: e.File("", "./index.html") is working with |
@heat1q The edge case should be fixed in v4.7.1. |
It's working now as expected. Thanks a lot! |
Issue Description
It appears that the file system improvement (#2064) in the latest release
v4.7.0
is breaking the backwards compatibility of static routes. Files that are registered with theStatic
method are no longer served on that route and a404
is returned. This issue has already been briefly mentioned in the comments of #2064. I'd like to continue the discussion on this issue here and give a short example.Checklist
Expected behaviour
The
Static
method should work and files should be served the same as with<=4.6.3
. In other words, the minor update should not change the behaviour of theStatic
method.Actual behaviour
Static file routes registered with
Static
are not serving the given files when updating to echov4.7.0
.Steps to reproduce
index.html
v4.6.3
curl http://localhost:8080 -v
==>200 OK
v4.7.0
curl http://localhost:8080 -v
==>404 Not found
Working code to debug
Version/commit
go version go1.17.6 darwin/arm64
echo v4.7.0
The text was updated successfully, but these errors were encountered: