From 91616baae2b271eeb551ceec0333c92d6294cf79 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 10 Sep 2019 00:06:20 +0100 Subject: upload-svr.go: fix panic with long filenames --- upload-svr.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'upload-svr.go') diff --git a/upload-svr.go b/upload-svr.go index efba0c9..2564f6b 100644 --- a/upload-svr.go +++ b/upload-svr.go @@ -93,14 +93,16 @@ func showIndex(w http.ResponseWriter, r *http.Request, msg string) { relpath += "/" } disppath := relpath + pad := "" if len(relpath) > maxFilenameLength { tail := "..>" if info.IsDir() { tail += "/" } disppath = disppath[:maxFilenameLength-len(tail)] + tail + } else { + pad = strings.Repeat(" ", maxFilenameLength-len(relpath)) } - pad := strings.Repeat(" ", maxFilenameLength-len(relpath)) sz := "-" if !info.IsDir() { sz = strconv.FormatInt(info.Size(), 10) -- cgit v1.2.1