Closed francislavoie closed 2 months ago
Can't you at least add a browseTemplateContext
method to retrieve the current total size of all files in the listing, so I (sponsor) can at least show what should be shown to my users with my custom browse.html?
You mean calculate both totals? I guess we can.
You mean calculate both totals?
Yes, exaclty.
In modules/caddyhttp/fileserver/browsetplcontext.go
, this one was added by me for https://github.com/caddyserver/caddy/issues/6002
// HumanTotalFileSize returns the total size of all files
// in the listing as a human-readable string in IEC format
// (i.e. power of 2 or base 1024).
func (btc browseTemplateContext) HumanTotalFileSize() string {
return humanize.IBytes(uint64(btc.TotalFileSize))
}
Closes https://github.com/caddyserver/caddy/issues/6409