mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 19:37:46 +08:00
core/corehttp: gateway_handler: Redirect to path with trailing slash when showing a directory's index.html
This commit is contained in:
parent
df97b968a1
commit
58d401c3b0
@ -144,6 +144,11 @@ func (i *gatewayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
foundIndex := false
|
||||
for _, link := range nd.Links {
|
||||
if link.Name == "index.html" {
|
||||
if urlPath[len(urlPath)-1] != '/' {
|
||||
http.Redirect(w, r, urlPath+"/", 302)
|
||||
return
|
||||
}
|
||||
|
||||
log.Debug("found index")
|
||||
foundIndex = true
|
||||
// return index page instead.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user