fix: don't calculate usage for files (#1973)

* fix: use incorrect suffix and return no 500(#1972、#1967)

* chore: set progress bar to small

Co-authored-by: Ramires Viana <59319979+ramiresviana@users.noreply.github.com>

* chore: refactoring

Co-authored-by: Oleg Lobanov <oleg@lobanov.me>
Co-authored-by: Ramires Viana <59319979+ramiresviana@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2022-06-13 12:50:39 +02:00
1 parent dcf0bc65bf
commit 577c0efa9c
2 files changed
+11 -4

No files matched your search

+7
View File
@@ -351,6 +351,13 @@ var diskUsage = withUser(func(w http.ResponseWriter, r *http.Request, d *data) (
return errToStatus(err), err
}
fPath := file.RealPath()
if !file.IsDir {
return renderJSON(w, r, &DiskUsageResponse{
Total: 0,
Used: 0,
})
}
usage, err := disk.UsageWithContext(r.Context(), fPath)
if err != nil {
return errToStatus(err), err