feat: report dir size correctly

This commit is contained in:
Louis Dalibard 2024-04-27 22:56:05 +02:00
parent 961cbdd48d
commit d3210878ea

View File

@ -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,
})
}