mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2024-04-21 12:32:08 +00:00
fix (s3): mv does not work for nested objects
The mv operation executes CopyObject API on the root object, meanwhile CopyObject doesn't copy the nested objects. As a result, the user loses all nested objects and after the move operation gets an empty bucket that requested to move. This change disallows possibility of moving nested objects.
This commit is contained in:
@@ -275,7 +275,7 @@ func (s S3Backend) Mv(from string, to string) error {
|
||||
t := s.path(to)
|
||||
client := s3.New(s.createSession(f.bucket))
|
||||
|
||||
if f.path == "" {
|
||||
if f.path == "" || strings.HasSuffix(from, "/") {
|
||||
return NewError("Can't move this", 403)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user