Skip to content

Commit 3c4d221

Browse files
committed
clean code
1 parent c07ef99 commit 3c4d221

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

modules/public/public.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,11 @@ func AssetsHandler(opts *Options) func(next http.Handler) http.Handler {
2929
if !filepath.IsAbs(custPath) {
3030
custPath = filepath.Join(setting.AppWorkPath, custPath)
3131
}
32-
3332
if !filepath.IsAbs(opts.Directory) {
3433
opts.Directory = filepath.Join(setting.AppWorkPath, opts.Directory)
3534
}
36-
if opts.Prefix == "" {
37-
opts.Prefix = "/"
38-
}
39-
if opts.Prefix != "/" {
40-
opts.Prefix = opts.Prefix + "/"
35+
if !strings.HasSuffix(opts.Prefix, "/") {
36+
opts.Prefix += "/"
4137
}
4238

4339
return func(next http.Handler) http.Handler {

0 commit comments

Comments
 (0)