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>pull/2013/head
parent
dcf0bc65bf
commit
577c0efa9c
|
@ -85,7 +85,7 @@
|
|||
v-if="$router.currentRoute.path.includes('/files/')"
|
||||
style="width: 90%; margin: 2em 2.5em 3em 2.5em"
|
||||
>
|
||||
<progress-bar :val="usage.usedPercentage" :size="large"></progress-bar>
|
||||
<progress-bar :val="usage.usedPercentage" size="small"></progress-bar>
|
||||
<br />
|
||||
{{ usage.used }} of {{ usage.total }} used
|
||||
</div>
|
||||
|
@ -102,9 +102,9 @@
|
|||
>
|
||||
<span> {{ version }}</span>
|
||||
</span>
|
||||
<span
|
||||
><a @click="help">{{ $t("sidebar.help") }}</a></span
|
||||
>
|
||||
<span>
|
||||
<a @click="help">{{ $t("sidebar.help") }}</a>
|
||||
</span>
|
||||
</p>
|
||||
</nav>
|
||||
</template>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue