Fix new dir and new file and utf8 names

This commit is contained in:
Henrique Dias
2017-07-03 16:40:52 +01:00
parent 9e42f0f1ed
commit 3785423d74
7 changed files with 14 additions and 6 deletions

8
api.go
View File

@@ -5,6 +5,7 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"os"
"strings"
)
@@ -212,13 +213,18 @@ func putHandler(c *requestContext, w http.ResponseWriter, r *http.Request) (int,
func postHandler(c *requestContext, w http.ResponseWriter, r *http.Request) (int, error) {
dst := r.Header.Get("Destination")
dst, err := url.QueryUnescape(dst)
if err != nil {
return errorToHTTP(err, true), err
}
src := r.URL.Path
if dst == "/" || src == "/" {
return http.StatusForbidden, nil
}
err := c.us.FileSystem.Rename(context.TODO(), src, dst)
err = c.us.FileSystem.Rename(context.TODO(), src, dst)
return errorToHTTP(err, true), err
}