Skip to content

Commit

Permalink
Bug fix: config file handler should user SwEntry.Path instead of /sw
Browse files Browse the repository at this point in the history
  • Loading branch information
dongxuny committed Dec 31, 2021
1 parent 11e6a39 commit e982ac2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions boot/sw_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (entry *SwEntry) ConfigFileHandler() http.HandlerFunc {
}

switch p {
case "/sw":
case strings.TrimSuffix(entry.Path, "/"):
var file io.ReadSeeker
var err error

Expand All @@ -280,10 +280,10 @@ func (entry *SwEntry) ConfigFileHandler() http.HandlerFunc {
}

http.ServeContent(w, r, "index.html", time.Now(), file)
case "/sw/swagger-config.json":
case path.Join(entry.Path, "swagger-config.json"):
http.ServeContent(w, r, "swagger-config.json", time.Now(), strings.NewReader(swConfigFileContents))
default:
p = strings.TrimPrefix(p, "/sw/")
p = strings.TrimPrefix(p, entry.Path)
value, ok := swaggerJsonFiles[p]

if ok {
Expand Down

0 comments on commit e982ac2

Please sign in to comment.