summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2021-02-02 23:20:34 +0100
committerPeter Wu <peter@lekensteyn.nl>2021-02-02 23:20:34 +0100
commitad0c238402d8da676f7f76ba9b4cd4669e6efee3 (patch)
treee5154f8e16c12d9aa1c2b5f53ff0ace2db60b3c9
parent97a29ed361f8db833521a872183d041e172727b4 (diff)
downloadscripts-ad0c238402d8da676f7f76ba9b4cd4669e6efee3.tar.gz
upload-svr.go: set last-modified to file mtimeHEADmaster
-rw-r--r--upload-svr.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/upload-svr.go b/upload-svr.go
index 9edb808..248b34c 100644
--- a/upload-svr.go
+++ b/upload-svr.go
@@ -20,7 +20,6 @@ import (
"path/filepath"
"strconv"
"strings"
- "time"
)
const (
@@ -351,7 +350,13 @@ func serveFile(w http.ResponseWriter, r *http.Request) {
return
}
defer f.Close()
- http.ServeContent(w, r, r.URL.Path, time.Time{}, f)
+ fileInfo, err := f.Stat()
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ log.Println(err)
+ return
+ }
+ http.ServeContent(w, r, r.URL.Path, fileInfo.ModTime(), f)
}
var (