s3: Fix IsNotExist()

This commit is contained in:
Alexander Neumann 2017-06-16 10:54:46 +02:00
parent bf8a155fb1
commit ea66ae0811
1 changed files with 9 additions and 1 deletions

View File

@ -84,7 +84,15 @@ func Open(cfg Config) (restic.Backend, error) {
// IsNotExist returns true if the error is caused by a not existing file.
func (be *Backend) IsNotExist(err error) bool {
debug.Log("IsNotExist(%T, %#v)", err, err)
return os.IsNotExist(err)
if os.IsNotExist(errors.Cause(err)) {
return true
}
if e, ok := errors.Cause(err).(minio.ErrorResponse); ok && e.Code == "NoSuchKey" {
return true
}
return false
}
// Join combines path components with slashes.