[#137] Add index page support
All checks were successful
/ DCO (pull_request) Successful in 56s
/ Builds (pull_request) Successful in 1m0s
/ Vulncheck (pull_request) Successful in 1m12s
/ Lint (pull_request) Successful in 2m14s
/ Tests (pull_request) Successful in 57s

Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
This commit is contained in:
Nikita Zinkevich 2024-09-20 15:20:46 +03:00
parent 7b07002269
commit 0c2f170252
2 changed files with 3 additions and 6 deletions

2
go.mod
View file

@ -8,6 +8,7 @@ require (
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20240718141740-ce8270568d36
git.frostfs.info/TrueCloudLab/zapjournald v0.0.0-20240124114243-cb2e66427d02
github.com/bluele/gcache v0.0.2
github.com/docker/go-units v0.4.0
github.com/fasthttp/router v1.4.1
github.com/nspcc-dev/neo-go v0.106.2
github.com/prometheus/client_golang v1.19.0
@ -49,7 +50,6 @@ require (
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v20.10.14+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect

View file

@ -1,6 +1,7 @@
package handler
import (
"cmp"
"html/template"
"path"
"strconv"
@ -91,11 +92,7 @@ func (h *Handler) browseObjects(c *fasthttp.RequestCtx, bucketName, prefix strin
} else if !aIsDir && bIsDir {
return 1
}
if a.FileName < b.FileName {
return -1
}
return 1
return cmp.Compare(a.FileName, b.FileName)
})
templatePath := h.config.IndexPageTemplatePath()