Skip to content

Commit e77bb7c

Browse files
authored
fix(service/configure): a variable scope bug (#32)
* fix(service/configure): Fixed a variable scope bug * fix(service/configure): Fixed a variable scope bug * fix(service/configure): Fixed a variable scope bug
1 parent 27963e4 commit e77bb7c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

framework/pkg/webserver/webserver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ func ServeDir(dir string, addr string, data map[string]any) error {
4444
http.Error(w, "Invalid file path", http.StatusBadRequest)
4545
return
4646
}
47-
48-
if stat, err := os.Stat(path); err == nil && !stat.IsDir() {
49-
http.ServeFile(w, r, path)
47+
safePath := absPath
48+
if stat, err := os.Stat(safePath); err == nil && !stat.IsDir() {
49+
http.ServeFile(w, r, safePath)
5050
return
5151
}
5252

0 commit comments

Comments
 (0)