diff options
Diffstat (limited to 'fs.go')
| -rw-r--r-- | fs.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -25,6 +25,7 @@ var ( ErrUnsupported = errors.New("unsupported operation") ErrInvalidProtocol = errors.New("invalid protocol") ErrInvalidOpenFlag = errors.New("invalid open flag, expects either O_WRONLY or O_RDONLY") + ErrNotDirectory = errors.New("not a directory") ) type Fs struct { @@ -150,8 +151,8 @@ func (fs *Fs) RemoveAll(path string) error { ctx, cancel := fs.contextWithTimeout() defer cancel() - if !strings.HasSuffix(path, "/") { - path += "/" + if !isDirPath(path) { + return ErrNotDirectory } objectsCh := fs.client.ListObjects(ctx, fs.bucket, minio.ListObjectsOptions{Prefix: path}) errc := fs.client.RemoveObjects(ctx, fs.bucket, objectsCh, minio.RemoveObjectsOptions{}) |
