remove useless variable

This commit is contained in:
Henrique Dias 2017-01-25 14:01:30 +00:00
parent a9aaba5841
commit fc2a71c662
2 changed files with 2 additions and 4 deletions

View File

@ -19,11 +19,10 @@ type Config struct {
*User
PrefixURL string
BaseURL string
AddrPath string
WebDavURL string
Token string // Anti CSRF token
HugoEnabled bool // Enables the Hugo plugin for File Manager
Users map[string]*User
WebDavURL string
BeforeSave CommandFunc
AfterSave CommandFunc
}
@ -239,7 +238,6 @@ func Parse(c *caddy.Controller) ([]Config, error) {
caddyConf := httpserver.GetConfig(c)
cfg.PrefixURL = strings.TrimSuffix(caddyConf.Addr.Path, "/")
cfg.AddrPath = strings.TrimSuffix(caddyConf.Addr.Path, "/")
cfg.WebDavURL = "/" + strings.TrimPrefix(cfg.WebDavURL, "/")
cfg.Handler = &webdav.Handler{
Prefix: cfg.BaseURL + cfg.WebDavURL,

View File

@ -138,7 +138,7 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
// If it's a dir and the path doesn't end with a trailing slash,
// redirect the user.
if fi.IsDir && !strings.HasSuffix(r.URL.Path, "/") {
http.Redirect(w, r, c.AddrPath+r.URL.Path+"/", http.StatusTemporaryRedirect)
http.Redirect(w, r, c.PrefixURL+r.URL.Path+"/", http.StatusTemporaryRedirect)
return 0, nil
}