2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-25 22:27:35 +00:00

s3: Fix IsNotExist()

This commit is contained in:
Alexander Neumann 2017-06-16 10:54:46 +02:00
parent bf8a155fb1
commit ea66ae0811

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.