From fc2a71c662ba89abcb5851088e585ccd69c78142 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 25 Jan 2017 14:01:30 +0000 Subject: [PATCH] remove useless variable --- config/config.go | 4 +--- filemanager.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/config/config.go b/config/config.go index 8c444707..be0d8388 100644 --- a/config/config.go +++ b/config/config.go @@ -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, diff --git a/filemanager.go b/filemanager.go index 7ceb5c05..548e9216 100644 --- a/filemanager.go +++ b/filemanager.go @@ -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 }