summaryrefslogtreecommitdiff
path: root/fs.go
diff options
context:
space:
mode:
Diffstat (limited to 'fs.go')
-rw-r--r--fs.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs.go b/fs.go
index 2ff9162..d886de8 100644
--- a/fs.go
+++ b/fs.go
@@ -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{})