From d3210878ea95fb6dfcca27e3fd826d6d1f3baf7a Mon Sep 17 00:00:00 2001 From: Louis Dalibard Date: Sat, 27 Apr 2024 22:56:05 +0200 Subject: [PATCH] feat: report dir size correctly --- route/route.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/route/route.go b/route/route.go index b74572f..eec4dd4 100644 --- a/route/route.go +++ b/route/route.go @@ -53,9 +53,13 @@ func HandleList(c *fiber.Ctx) error { entries := make([]html.Entry, 0, len(config.Config.ServeDirs)) for _, key := range keys { + dirEntrySize, err := RecursivelyGetSize(config.Config.ServeDirs[key]) + if err != nil { + return c.Status(fiber.StatusInternalServerError).SendString(err.Error()) + } entries = append(entries, html.Entry{ Name: key, - Size: -1, + Size: dirEntrySize, IsDir: true, }) }