Former-commit-id: f8355933ef7878ec9120a615cdbb5c212583bc86 [formerly f46e21a47ed05f968bab1a77a8fe291b44c5f7c7] [formerly 4cacf04503d5aadb4ef620ed039dbf8a3a91c4a4 [formerly 1d235c9852]]
Former-commit-id: 27158f0c815dd3160768253a38d02712f01c90ef [formerly be1a5d2cbcf867c7292cd58ee66cfb42c55cfc41]
Former-commit-id: eb527d245318ce88f358964b0b3dff8d9e4a9ffd
pull/726/head
Henrique Dias 2017-07-02 18:16:02 +01:00
parent 49789ea885
commit 15f997faf0
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 {