fix: hugo full path in URL #288 (#306)

pull/329/head
Henrique Dias 2017-12-27 16:00:16 +00:00 committed by GitHub
parent b1c36ec71f
commit 68c4072bd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -84,7 +84,8 @@ func (h Hugo) Hook(c *fm.Context, w http.ResponseWriter, r *http.Request) (int,
return http.StatusForbidden, nil return http.StatusForbidden, nil
} }
filename := filepath.Join(c.User.Scope, r.URL.Path) filename := filepath.Clean(r.URL.Path)
filename = strings.TrimPrefix(filename, string(filepath.Separator))
archetype := r.Header.Get("archetype") archetype := r.Header.Get("archetype")
ext := filepath.Ext(filename) ext := filepath.Ext(filename)