File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ func AssetsHandler(opts *Options) func(next http.Handler) http.Handler {
36
36
if opts .Prefix == "" {
37
37
opts .Prefix = "/"
38
38
}
39
+ if opts .Prefix != "/" {
40
+ opts .Prefix = opts .Prefix + "/"
41
+ }
39
42
40
43
return func (next http.Handler ) http.Handler {
41
44
return http .HandlerFunc (func (resp http.ResponseWriter , req * http.Request ) {
@@ -54,10 +57,11 @@ func AssetsHandler(opts *Options) func(next http.Handler) http.Handler {
54
57
resp .WriteHeader (http .StatusNotFound )
55
58
return
56
59
}
57
- if ! strings .HasPrefix (file , "/ " ) {
58
- next . ServeHTTP ( resp , req )
60
+ if strings .Contains (file , "\\ " ) {
61
+ resp . WriteHeader ( http . StatusBadRequest )
59
62
return
60
63
}
64
+ file = "/" + file
61
65
62
66
var written bool
63
67
if opts .CorsHandler != nil {
You can’t perform that action at this time.
0 commit comments