forked from TrueCloudLab/distribution
Address PathNotFoundError in (*manifestStore).Exists
Exists was returning an error when encountering a PathNotFoundError when it should just return false without an error.
This commit is contained in:
parent
2f78886aac
commit
1a75fccb43
1 changed files with 6 additions and 1 deletions
|
@ -24,8 +24,13 @@ func (ms *manifestStore) Exists(name, tag string) (bool, error) {
|
||||||
|
|
||||||
fi, err := ms.driver.Stat(p)
|
fi, err := ms.driver.Stat(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
switch err.(type) {
|
||||||
|
case storagedriver.PathNotFoundError:
|
||||||
|
return false, nil
|
||||||
|
default:
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if fi.IsDir() {
|
if fi.IsDir() {
|
||||||
return false, fmt.Errorf("unexpected directory at path: %v, name=%s tag=%s", p, name, tag)
|
return false, fmt.Errorf("unexpected directory at path: %v, name=%s tag=%s", p, name, tag)
|
||||||
|
|
Loading…
Reference in a new issue