repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
94c4b4d
parent
80b4959
author
Eric Bower
date
2025-12-09 12:41:35 -0500 EST
fix: image request detection was matching anything instead of .jpg
2 files changed,  +3, -3
M pkg/apps/pgs/web.go
+1, -1
1@@ -404,7 +404,7 @@ func WebPerm(proj *db.Project) bool {
2 	return proj.Acl.Type == "public" || proj.Acl.Type == ""
3 }
4 
5-var imgRegex = regexp.MustCompile("(.+.(?:jpg|jpeg|png|gif|webp|svg))(/.+)")
6+var imgRegex = regexp.MustCompile(`(.+\.(?:jpg|jpeg|png|gif|webp|svg))(/.+)`)
7 
8 func (web *WebRouter) AssetRequest(perm func(proj *db.Project) bool) http.HandlerFunc {
9 	return func(w http.ResponseWriter, r *http.Request) {
M pkg/apps/prose/api.go
+2, -2
 1@@ -989,8 +989,8 @@ func createSubdomainRoutes(staticRoutes []shared.Route) []shared.Route {
 2 		routes,
 3 		shared.NewRoute("GET", "/raw/(.+)", postRawHandler),
 4 		shared.NewRoute("GET", "/(.+).md", postRawHandler),
 5-		shared.NewRoute("GET", "/(.+.(?:jpg|jpeg|png|gif|webp|svg|ico))/(.+)", imgRequest),
 6-		shared.NewRoute("GET", "/(.+.(?:jpg|jpeg|png|gif|webp|svg|ico))$", imgRequest),
 7+		shared.NewRoute("GET", `/(.+\.(?:jpg|jpeg|png|gif|webp|svg|ico))/(.+)`, imgRequest),
 8+		shared.NewRoute("GET", `/(.+\.(?:jpg|jpeg|png|gif|webp|svg|ico))$`, imgRequest),
 9 		shared.NewRoute("GET", "/(.+).html", postHandler),
10 		shared.NewRoute("GET", "/(.+)", postHandler),
11 	)