Skip to content

Commit 7ff0559

Browse files
intel352claude
andcommitted
fix(http): ensure path boundary before wildcard in static.fileserver route
The Go net/http router requires wildcard segments like {path...} to start at a path boundary (/). The static.fileserver was generating routes like "GET /ui{path...}" which panicked. Now ensures a / separator: "/ui" → "/ui/{path...}", "/" → "/{path...}". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2e62989 commit 7ff0559

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

plugins/http/wiring.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package http
22

33
import (
44
"fmt"
5+
"strings"
56

67
"github.com/CrisisTextLine/modular"
78
"github.com/GoCodeAlone/workflow/config"
@@ -131,8 +132,12 @@ func wireStaticFileServers(app modular.Application, cfg *config.WorkflowConfig)
131132
}
132133

133134
if targetRouter != nil {
134-
targetRouter.AddRoute("GET", sfs.Prefix()+"{path...}", sfs)
135-
_ = fmt.Sprintf("Registered static file server %s on router %s at prefix: %s", sfs.Name(), targetName, sfs.Prefix())
135+
prefix := sfs.Prefix()
136+
// Ensure the wildcard segment is at a path boundary (Go net/http requirement).
137+
// e.g. "/ui" → "/ui/{path...}", "/" → "/{path...}"
138+
routePattern := strings.TrimSuffix(prefix, "/") + "/{path...}"
139+
targetRouter.AddRoute("GET", routePattern, sfs)
140+
_ = fmt.Sprintf("Registered static file server %s on router %s at prefix: %s", sfs.Name(), targetName, prefix)
136141
}
137142
}
138143

0 commit comments

Comments
 (0)