Updated use of convertFileSize() in a ScanDirectory() function.
This commit is contained in:
parent
0798ba6602
commit
920f9f08ee
@ -52,12 +52,11 @@ func ScanDirectory(path, urlBase string) (entries []DirEntry, stats DirStats, er
|
||||
})
|
||||
stats.Directories++
|
||||
} else {
|
||||
_, _, sz := convertFileSize(entry.Size())
|
||||
fileEntries = append(fileEntries, DirEntry{
|
||||
Name: entry.Name(),
|
||||
Link: "/file" + urlBase + url.PathEscape(entry.Name()),
|
||||
Datetime: entry.ModTime(),
|
||||
Size: sz,
|
||||
Size: convertFileSize(entry.Size()),
|
||||
})
|
||||
|
||||
totalFilesSize += entry.Size()
|
||||
@ -65,8 +64,7 @@ func ScanDirectory(path, urlBase string) (entries []DirEntry, stats DirStats, er
|
||||
}
|
||||
}
|
||||
|
||||
_, _, sz := convertFileSize(totalFilesSize)
|
||||
stats.FilesSize = sz
|
||||
stats.FilesSize = convertFileSize(totalFilesSize)
|
||||
|
||||
entries = append(entries, dirEntries...)
|
||||
entries = append(entries, fileEntries...)
|
||||
|
Loading…
Reference in New Issue
Block a user