repos / pico

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

commit
c8daace
parent
7f7174f
author
Eric Bower
date
2024-11-08 15:14:32 +0000 UTC
fix(pgs): set content-length so caddy can compress content
1 files changed,  +4, -0
M pgs/web_asset_handler.go
+4, -0
 1@@ -9,6 +9,7 @@ import (
 2 	"net/url"
 3 	"path/filepath"
 4 	"regexp"
 5+	"strconv"
 6 	"strings"
 7 
 8 	"net/http/httputil"
 9@@ -210,6 +211,9 @@ func (h *ApiAssetHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
10 	}
11 
12 	if info != nil {
13+		if info.Size != 0 {
14+			w.Header().Add("content-length", strconv.Itoa(int(info.Size)))
15+		}
16 		if info.ETag != "" {
17 			w.Header().Add("etag", info.ETag)
18 		}