simplify some stuff

This commit is contained in:
Henrique Dias
2016-03-12 09:52:04 +00:00
parent 3301b60485
commit d41e4cc047
9 changed files with 33 additions and 54 deletions

View File

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