diff --git a/modules/base/tool.go b/modules/base/tool.go index 8576b941cc..3f8b8ffa84 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -121,7 +121,7 @@ func humanateBytes(s uint64, base float64, sizes []string) string { } // FileSize calculates the file size and generate user-friendly string. -func FileSize(s uint64) string { +func FileSize(s int64) string { sizes := []string{"B", "KB", "MB", "GB", "TB", "PB", "EB"} return humanateBytes(uint64(s), 1024, sizes) } diff --git a/templates/repo/single.tmpl b/templates/repo/single.tmpl index b99950ef51..5774c0051d 100644 --- a/templates/repo/single.tmpl +++ b/templates/repo/single.tmpl @@ -47,7 +47,7 @@ {{if .IsDir}} {{.Name}} {{else}} - {{.Name}} - {{.Size}} + {{.Name}} - {{FileSize .Size}} {{end}}