change var name

This commit is contained in:
Henrique Dias 2016-06-21 16:19:54 +01:00
parent ad0f5d57fe
commit b24bccfa37
2 changed files with 128 additions and 74 deletions

195
binary.go

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,8 @@ import (
"github.com/mholt/caddy/caddyhttp/httpserver" "github.com/mholt/caddy/caddyhttp/httpserver"
) )
const assetsURL = "/_filemanagerinternal" // AssetsURL
const AssetsURL = "/_filemanagerinternal"
// FileManager is an http.Handler that can show a file listing when // FileManager is an http.Handler that can show a file listing when
// directories in the given paths are specified. // directories in the given paths are specified.
@ -41,7 +42,7 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
for i := range f.Configs { for i := range f.Configs {
if httpserver.Path(r.URL.Path).Matches(f.Configs[i].BaseURL) { if httpserver.Path(r.URL.Path).Matches(f.Configs[i].BaseURL) {
c = &f.Configs[i] c = &f.Configs[i]
assets = httpserver.Path(r.URL.Path).Matches(c.BaseURL + assetsURL) assets = httpserver.Path(r.URL.Path).Matches(c.BaseURL + AssetsURL)
if r.Method != http.MethodPost && !assets { if r.Method != http.MethodPost && !assets {
fi, code, err = GetFileInfo(r.URL, c) fi, code, err = GetFileInfo(r.URL, c)
@ -112,7 +113,7 @@ func ErrorToHTTPCode(err error) int {
// ServeAssets provides the needed assets for the front-end // ServeAssets provides the needed assets for the front-end
func ServeAssets(w http.ResponseWriter, r *http.Request, c *Config) (int, error) { func ServeAssets(w http.ResponseWriter, r *http.Request, c *Config) (int, error) {
// gets the filename to be used with Assets function // gets the filename to be used with Assets function
filename := strings.Replace(r.URL.Path, c.BaseURL+assetsURL, "public", 1) filename := strings.Replace(r.URL.Path, c.BaseURL+AssetsURL, "public", 1)
file, err := Asset(filename) file, err := Asset(filename)
if err != nil { if err != nil {
return http.StatusNotFound, nil return http.StatusNotFound, nil