Handle "NotFound" error code from HeadObject (#228)
* Handle "NotFound" error code from HeadObject This accommodates third party implementations of the S3 interface, such as Minio, that may return a different error string. * Check NotFound error string in test This also fixes an incorrect return value.
This commit is contained in:
parent
daa2250530
commit
204044e4b9
|
@ -364,7 +364,7 @@ func (store S3Store) GetInfo(id string) (info tusd.FileInfo, err error) {
|
||||||
Key: store.keyWithPrefix(uploadId + ".part"),
|
Key: store.keyWithPrefix(uploadId + ".part"),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !isAwsError(err, s3.ErrCodeNoSuchKey) && !isAwsError(err, "AccessDenied") {
|
if !isAwsError(err, s3.ErrCodeNoSuchKey) && !isAwsError(err, "NotFound") && !isAwsError(err, "AccessDenied") {
|
||||||
return info, err
|
return info, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -381,9 +381,7 @@ func TestDeclareLength(t *testing.T) {
|
||||||
s3obj.EXPECT().HeadObject(&s3.HeadObjectInput{
|
s3obj.EXPECT().HeadObject(&s3.HeadObjectInput{
|
||||||
Bucket: aws.String("bucket"),
|
Bucket: aws.String("bucket"),
|
||||||
Key: aws.String("uploadId.part"),
|
Key: aws.String("uploadId.part"),
|
||||||
}).Return(&s3.HeadObjectOutput{
|
}).Return(&s3.HeadObjectOutput{}, awserr.New("NotFound", "Not Found", nil)),
|
||||||
ContentLength: aws.Int64(0),
|
|
||||||
}, nil),
|
|
||||||
s3obj.EXPECT().PutObject(&s3.PutObjectInput{
|
s3obj.EXPECT().PutObject(&s3.PutObjectInput{
|
||||||
Bucket: aws.String("bucket"),
|
Bucket: aws.String("bucket"),
|
||||||
Key: aws.String("uploadId.info"),
|
Key: aws.String("uploadId.info"),
|
||||||
|
|
Loading…
Reference in New Issue