@@ -22,30 +22,28 @@ type Options struct {
22
22
}
23
23
24
24
// AssetsHandler implements the static handler for serving custom or original assets.
25
- func AssetsHandler (opts * Options ) func (http.Handler ) http.Handler {
26
- return func (next http.Handler ) http.Handler {
27
- var custPath = filepath .Join (setting .CustomPath , "public" )
28
- if ! filepath .IsAbs (custPath ) {
29
- custPath = filepath .Join (setting .AppWorkPath , custPath )
30
- }
25
+ func AssetsHandler (opts * Options ) func (resp http.ResponseWriter , req * http.Request ) {
26
+ var custPath = filepath .Join (setting .CustomPath , "public" )
27
+ if ! filepath .IsAbs (custPath ) {
28
+ custPath = filepath .Join (setting .AppWorkPath , custPath )
29
+ }
31
30
32
- if ! filepath .IsAbs (opts .Directory ) {
33
- opts .Directory = filepath .Join (setting .AppWorkPath , opts .Directory )
34
- }
31
+ if ! filepath .IsAbs (opts .Directory ) {
32
+ opts .Directory = filepath .Join (setting .AppWorkPath , opts .Directory )
33
+ }
35
34
36
- return http . HandlerFunc ( func (resp http.ResponseWriter , req * http.Request ) {
37
- // custom files
38
- if opts .handle (resp , req , http .Dir (custPath ), opts .Prefix ) {
39
- return
40
- }
35
+ return func (resp http.ResponseWriter , req * http.Request ) {
36
+ // custom files
37
+ if opts .handle (resp , req , http .Dir (custPath ), opts .Prefix ) {
38
+ return
39
+ }
41
40
42
- // internal files
43
- if opts .handle (resp , req , fileSystem (opts .Directory ), opts .Prefix ) {
44
- return
45
- }
41
+ // internal files
42
+ if opts .handle (resp , req , fileSystem (opts .Directory ), opts .Prefix ) {
43
+ return
44
+ }
46
45
47
- resp .WriteHeader (404 )
48
- })
46
+ resp .WriteHeader (404 )
49
47
}
50
48
}
51
49
0 commit comments