pull/144/head
Henrique Dias 2017-07-02 18:16:02 +01:00
parent de66f1a9fb
commit 1d235c9852
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
1 changed files with 9 additions and 1 deletions

10
api.go
View File

@ -79,7 +79,7 @@ func resourceHandler(c *requestContext, w http.ResponseWriter, r *http.Request)
case http.MethodPut:
return putHandler(c, w, r)
case http.MethodPost:
// Handle renaming
return postHandler(c, w, r)
}
/* // Execute beforeSave if it is a PUT request.
@ -211,6 +211,14 @@ func putHandler(c *requestContext, w http.ResponseWriter, r *http.Request) (int,
return http.StatusOK, nil
}
func postHandler(c *requestContext, w http.ResponseWriter, r *http.Request) (int, error) {
dst := r.Header.Get("Destination")
src := r.URL.Path
err := c.us.fileSystem.Rename(context.TODO(), src, dst)
return errorToHTTP(err, true), err
}
// displayMode obtaisn the display mode from URL, or from the
// cookie.
func displayMode(w http.ResponseWriter, r *http.Request, scope string) string {