repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
6dab28c
parent
3154f99
author
Eric Bower
date
2024-01-31 05:39:32 +0000 UTC
fix(pgs): correct content type
1 files changed,  +4, -1
M pgs/api.go
+4, -1
 1@@ -256,7 +256,6 @@ func (h *AssetHandler) handle(w http.ResponseWriter) {
 2 			)
 3 		} else {
 4 			c, _, _, err = h.Storage.GetFile(h.Bucket, fp.Filepath)
 5-			contentType = storage.GetMimeType(assetFilepath)
 6 		}
 7 		if err == nil {
 8 			contents = c
 9@@ -277,6 +276,10 @@ func (h *AssetHandler) handle(w http.ResponseWriter) {
10 	}
11 	defer contents.Close()
12 
13+	if contentType == "" {
14+		contentType = storage.GetMimeType(assetFilepath)
15+	}
16+
17 	w.Header().Add("Content-Type", contentType)
18 	w.WriteHeader(status)
19 	_, err = io.Copy(w, contents)