File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ var migrationsFS embed.FS
43
43
//go:embed index.html
44
44
var indexHTML string
45
45
46
+ //go:embed favicon.svg
47
+ var faviconSVG []byte
48
+
46
49
var db * sql.DB
47
50
48
51
func init () {
@@ -589,10 +592,21 @@ func main() {
589
592
func createRouter () http.Handler {
590
593
mux := http .NewServeMux ()
591
594
595
+ // Serve favicon.svg
596
+ mux .HandleFunc ("/favicon.svg" , func (w http.ResponseWriter , r * http.Request ) {
597
+ w .Header ().Set ("Content-Type" , "image/svg+xml" )
598
+ w .Write (faviconSVG )
599
+ })
600
+
592
601
// Serve embedded index.html at root
593
602
mux .HandleFunc ("/" , func (w http.ResponseWriter , r * http.Request ) {
594
- w .Header ().Set ("Content-Type" , "text/html; charset=utf-8" )
595
- fmt .Fprint (w , indexHTML )
603
+ // Only serve index.html for root path or non-file paths
604
+ if r .URL .Path == "/" || r .URL .Path == "" {
605
+ w .Header ().Set ("Content-Type" , "text/html; charset=utf-8" )
606
+ fmt .Fprint (w , indexHTML )
607
+ } else {
608
+ http .NotFound (w , r )
609
+ }
596
610
})
597
611
598
612
mux .HandleFunc ("/api/projects" , func (w http.ResponseWriter , r * http.Request ) {
You can’t perform that action at this time.
0 commit comments