diff --git a/core/util/breadcrumbs.go b/core/util/breadcrumbs.go index e6a070c..38f3b51 100644 --- a/core/util/breadcrumbs.go +++ b/core/util/breadcrumbs.go @@ -8,7 +8,7 @@ import ( func GenerateBreadcrumbs(path string) map[string]interface{} { breadcrumbs := make(map[string]interface{}) parts := strings.Split(path, "/") - fullPath := "" + fullPath := "/s3" for i, part := range parts { if part == "" { continue diff --git a/core/util/object.go b/core/util/object.go index f77779d..c62f26b 100644 --- a/core/util/object.go +++ b/core/util/object.go @@ -22,11 +22,9 @@ func GenerateS3Objects(r *http.Request, path string) ([]model.S3Object, error) { obj.Name = entry.Name() obj.FullPath = filepath.Join(r.URL.Path, entry.Name()) obj.IsDir = entry.IsDir() - slog.Info("S3Object", "data", obj) s3Objects = append(s3Objects, obj) } - slog.Info("S3Objects", "data", s3Objects) return s3Objects, nil } diff --git a/static/index.html b/static/index.html index 28c5935..1e2d8cb 100644 --- a/static/index.html +++ b/static/index.html @@ -17,11 +17,9 @@
- s3:// - {{range .}} - {{if .IsDir}} - / {{.Name}} - {{end}} + s3: + {{range $key, $value := .Breadcrumbs}} + / {{$key}} {{end}}
diff --git a/web/s3_controller.go b/web/s3_controller.go index d07decb..442efd0 100644 --- a/web/s3_controller.go +++ b/web/s3_controller.go @@ -27,7 +27,7 @@ func S3Handler(w http.ResponseWriter, r *http.Request) { dataMap := map[string]interface{}{ "S3Objects": s3Objects, - "breadcrumbs": "Some additional data", + "Breadcrumbs": util.GenerateBreadcrumbs(path), } tmpl, err := template.ParseFiles("static/index.html") @@ -37,6 +37,7 @@ func S3Handler(w http.ResponseWriter, r *http.Request) { return } + slog.Info("dataMap", "dataMap", dataMap) tmpl.Execute(w, dataMap) } func download(path string) {