Commit 94c4b4d
Eric Bower
·
2025-12-09 12:41:35 -0500 EST
parent 80b4959
fix: image request detection was matching anything instead of .jpg
2 files changed,
+3,
-3
+1,
-1
| ... | ... | @@ -404,7 +404,7 @@ func WebPerm(proj *db.Project) bool { | |
| 404 | 404 | return proj.Acl.Type == "public" || proj.Acl.Type == "" | |
| 405 | 405 | } | |
| 406 | 406 | ||
| 407 | - | var imgRegex = regexp.MustCompile("(.+.(?:jpg|jpeg|png|gif|webp|svg))(/.+)") | |
| 407 | + | var imgRegex = regexp.MustCompile(`(.+\.(?:jpg|jpeg|png|gif|webp|svg))(/.+)`) | |
| 408 | 408 | ||
| 409 | 409 | func (web *WebRouter) AssetRequest(perm func(proj *db.Project) bool) http.HandlerFunc { | |
| 410 | 410 | return func(w http.ResponseWriter, r *http.Request) { |
+2,
-2
| ... | ... | @@ -989,8 +989,8 @@ func createSubdomainRoutes(staticRoutes []shared.Route) []shared.Route { | |
| 989 | 989 | routes, | |
| 990 | 990 | shared.NewRoute("GET", "/raw/(.+)", postRawHandler), | |
| 991 | 991 | shared.NewRoute("GET", "/(.+).md", postRawHandler), | |
| 992 | - | shared.NewRoute("GET", "/(.+.(?:jpg|jpeg|png|gif|webp|svg|ico))/(.+)", imgRequest), | |
| 993 | - | shared.NewRoute("GET", "/(.+.(?:jpg|jpeg|png|gif|webp|svg|ico))$", imgRequest), | |
| 992 | + | shared.NewRoute("GET", `/(.+\.(?:jpg|jpeg|png|gif|webp|svg|ico))/(.+)`, imgRequest), | |
| 993 | + | shared.NewRoute("GET", `/(.+\.(?:jpg|jpeg|png|gif|webp|svg|ico))$`, imgRequest), | |
| 994 | 994 | shared.NewRoute("GET", "/(.+).html", postHandler), | |
| 995 | 995 | shared.NewRoute("GET", "/(.+)", postHandler), | |
| 996 | 996 | ) |