From 2e111eab9fef3d4b342a2077b527bf402aa70dd2 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 7 Dec 2016 20:03:06 +0000 Subject: [PATCH] update --- assets/public/js/application.js | 2 -- hugo.go | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/public/js/application.js b/assets/public/js/application.js index b19b9821..2e75e194 100644 --- a/assets/public/js/application.js +++ b/assets/public/js/application.js @@ -40,7 +40,6 @@ document.addEventListener('listing', event => { let request = new XMLHttpRequest(); request.open("POST", window.location); request.setRequestHeader('Filename', name); - request.setRequestHeader('Token', token); request.setRequestHeader('Archetype', archetype); request.send(); request.onreadystatechange = function() { @@ -91,7 +90,6 @@ document.addEventListener('editor', event => { let request = new XMLHttpRequest(); request.open("PUT", window.location); request.setRequestHeader('Kind', kind); - request.setRequestHeader('Token', token); request.setRequestHeader('Schedule', date); request.send(JSON.stringify(data)); request.onreadystatechange = function() { diff --git a/hugo.go b/hugo.go index c70b777c..30de0d98 100644 --- a/hugo.go +++ b/hugo.go @@ -94,6 +94,8 @@ func (h Hugo) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) { } if canBeEdited(r.URL.Path) && r.Method == http.MethodPut { + r.URL.Path = strings.Replace(r.URL.Path, h.FileManager.Configs[0].BaseURL, h.FileManager.Configs[0].WebDavURL, -1) + code, err := h.FileManager.ServeHTTP(w, r) if err != nil { @@ -148,7 +150,7 @@ func (h Hugo) Schedule(w http.ResponseWriter, r *http.Request) (int, error) { scheduler := cron.New() scheduler.AddFunc(t.Format("05 04 15 02 01 *"), func() { filename := r.URL.Path - filename = strings.Replace(filename, h.Config.BaseURL, h.Config.Root, 1) + filename = strings.Replace(filename, h.FileManager.Configs[0].WebDavURL, h.Config.Root, 1) filename = filepath.Clean(filename) raw, err := ioutil.ReadFile(filename)