diff options
| author | Marin Ivanov <[email protected]> | 2022-08-15 03:33:22 +0300 |
|---|---|---|
| committer | Marin Ivanov <[email protected]> | 2022-08-15 03:33:22 +0300 |
| commit | 04200620823cf9b11e0185234429af6180110adc (patch) | |
| tree | 6a63c0cabec90c3562c939d38c8e51e99dd48e0d /fs.go | |
| parent | 2f1bb584258c53d74f97b04a6045f0e0b838f061 (diff) | |
Test Remove, RemoveAll, Rename
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{}) |
