fix(routes): restore SPA routing after Echo v5 upgrade

In Echo v5, the 404 error for unmatched routes implements the
HTTPStatusCoder interface but is not a *HTTPError. This caused
the static middleware to fail to catch 404s and serve index.html
for SPA routes, leading to reloading SPA routes returning 404.

Caused by regression introduced in 9a61453e8.

Fixes #2149
Fixes #2152
This commit is contained in:
kolaente
2026-01-25 11:04:32 +01:00
parent 233908b30b
commit b21c9acb0d

View File

@@ -166,8 +166,8 @@ func static() echo.MiddlewareFunc {
return err
}
var he *echo.HTTPError
if !errors.As(err, &he) || he.Code != http.StatusNotFound {
var he echo.HTTPStatusCoder
if !errors.As(err, &he) || he.StatusCode() != http.StatusNotFound {
return err
}