forked from TrueCloudLab/distribution
driver/swift: treat empty object list as a PathNotFoundError
Swift returns an empty object list when trying to read a non-existing object path, treat it as a PathNotFoundError when trying to list a non existing virtual directory. Signed-off-by: David li <wenquan.li@hpe.com>
This commit is contained in:
parent
f25ccea279
commit
79d4d7f546
1 changed files with 1 additions and 1 deletions
|
@ -589,7 +589,7 @@ func (d *driver) List(ctx context.Context, path string) ([]string, error) {
|
||||||
files = append(files, strings.TrimPrefix(strings.TrimSuffix(obj.Name, "/"), d.swiftPath("/")))
|
files = append(files, strings.TrimPrefix(strings.TrimSuffix(obj.Name, "/"), d.swiftPath("/")))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == swift.ContainerNotFound {
|
if err == swift.ContainerNotFound || (len(objects) == 0 && path != "/") {
|
||||||
return files, storagedriver.PathNotFoundError{Path: path}
|
return files, storagedriver.PathNotFoundError{Path: path}
|
||||||
}
|
}
|
||||||
return files, err
|
return files, err
|
||||||
|
|
Loading…
Reference in a new issue