Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed May 29, 2021
1 parent c07ef99 commit 3c4d221
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions modules/public/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ func AssetsHandler(opts *Options) func(next http.Handler) http.Handler {
if !filepath.IsAbs(custPath) {
custPath = filepath.Join(setting.AppWorkPath, custPath)
}

if !filepath.IsAbs(opts.Directory) {
opts.Directory = filepath.Join(setting.AppWorkPath, opts.Directory)
}
if opts.Prefix == "" {
opts.Prefix = "/"
}
if opts.Prefix != "/" {
opts.Prefix = opts.Prefix + "/"
if !strings.HasSuffix(opts.Prefix, "/") {
opts.Prefix += "/"
}

return func(next http.Handler) http.Handler {
Expand Down

0 comments on commit 3c4d221

Please sign in to comment.