remove dangerous global variables

This commit is contained in:
Henrique Dias
2016-06-16 17:01:41 +01:00
parent 48878cc3b5
commit af2785e510
11 changed files with 66 additions and 82 deletions

View File

@@ -5,16 +5,17 @@ import (
"os"
"strings"
"github.com/hacdias/caddy-hugo/config"
s "github.com/hacdias/caddy-hugo/tools/server"
)
// DELETE handles the delete requests on browse pages
func DELETE(w http.ResponseWriter, r *http.Request) (int, error) {
func DELETE(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error) {
// Remove both beginning and trailing slashes
path := r.URL.Path
path = strings.TrimPrefix(path, "/")
path = strings.TrimSuffix(path, "/")
path = conf.Path + path
path = c.Path + path
message := "File deleted."