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
c39158d48c
commit
aa08ced9d7
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