update usb show name

This commit is contained in:
a624669980@163.com 2022-08-19 13:48:52 +08:00
parent 22c7d71f93
commit 991ee424ea

View File

@ -3,6 +3,7 @@ package v1
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"path/filepath"
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
@ -210,6 +211,9 @@ func GetDisksUSBList(c *gin.Context) {
tempChildren.Size, _ = strconv.ParseUint(child.FSSize, 10, 64) tempChildren.Size, _ = strconv.ParseUint(child.FSSize, 10, 64)
tempChildren.Avail, _ = strconv.ParseUint(child.FSAvail, 10, 64) tempChildren.Avail, _ = strconv.ParseUint(child.FSAvail, 10, 64)
tempChildren.Name = child.Label tempChildren.Name = child.Label
if len(tempChildren.Name) == 0 {
tempChildren.Name = filepath.Base(child.MountPoint)
}
avail, _ := strconv.ParseUint(child.FSAvail, 10, 64) avail, _ := strconv.ParseUint(child.FSAvail, 10, 64)
children = append(children, tempChildren) children = append(children, tempChildren)
temp.Avail += avail temp.Avail += avail