From 1d4a3005ff28baa63f5bb9e63d7fb241b3c017a9 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 27 Dec 2017 16:00:16 +0000 Subject: [PATCH] fix: hugo full path in URL #288 (#306) Former-commit-id: 56143acfb6b2817df49998c96f9b70174327c31c [formerly b763216262fd57a06d7f343a96891cc62f5ba358] [formerly 8a09d84e73ce9e3865bcd65a8071f2e5cb48333f [formerly 68c4072bd1d4635effc21f98a21d705bc2a2fb4a]] Former-commit-id: cbec5adf02b6d83b27c7286546a7a291b2344256 [formerly 94dbfbb4aaf51abcd809f3562a4a8a53945782f5] Former-commit-id: 3f11f9c8be4f7e9b063789fca73212ca838ce1ad --- staticgen/hugo.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/staticgen/hugo.go b/staticgen/hugo.go index 4a12ea77..eb9b5b18 100644 --- a/staticgen/hugo.go +++ b/staticgen/hugo.go @@ -84,7 +84,8 @@ func (h Hugo) Hook(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, 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") ext := filepath.Ext(filename)