mirror of
https://github.com/thegeeklab/wp-s3-action.git
synced 2024-09-18 19:12:47 +02:00
fix: ensure uploads on 404 NotFound errors (#125)
This commit is contained in:
parent
88504616e3
commit
5bb291acf9
|
@ -71,8 +71,8 @@ func (u *S3) Upload(ctx context.Context, opt S3UploadOptions) error {
|
||||||
Key: &opt.RemoteObjectKey,
|
Key: &opt.RemoteObjectKey,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var noSuchKeyError *types.NoSuchKey
|
var notFoundErr *types.NotFound
|
||||||
if !errors.As(err, &noSuchKeyError) {
|
if !errors.As(err, ¬FoundErr) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ func TestS3_Upload(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
mockS3Client := mocks.NewMockS3APIClient(t)
|
mockS3Client := mocks.NewMockS3APIClient(t)
|
||||||
mockS3Client.On("HeadObject", mock.Anything, mock.Anything).Return(&s3.HeadObjectOutput{}, &types.NoSuchKey{})
|
mockS3Client.On("HeadObject", mock.Anything, mock.Anything).Return(&s3.HeadObjectOutput{}, &types.NotFound{})
|
||||||
mockS3Client.On("PutObject", mock.Anything, mock.Anything).Return(&s3.PutObjectOutput{}, nil)
|
mockS3Client.On("PutObject", mock.Anything, mock.Anything).Return(&s3.PutObjectOutput{}, nil)
|
||||||
|
|
||||||
return &S3{
|
return &S3{
|
||||||
|
@ -227,7 +227,7 @@ func TestS3_Upload(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
mockS3Client := mocks.NewMockS3APIClient(t)
|
mockS3Client := mocks.NewMockS3APIClient(t)
|
||||||
mockS3Client.On("HeadObject", mock.Anything, mock.Anything).Return(&s3.HeadObjectOutput{}, &types.NoSuchKey{})
|
mockS3Client.On("HeadObject", mock.Anything, mock.Anything).Return(&s3.HeadObjectOutput{}, &types.NotFound{})
|
||||||
|
|
||||||
return &S3{
|
return &S3{
|
||||||
client: mockS3Client,
|
client: mockS3Client,
|
||||||
|
|
|
@ -76,7 +76,7 @@ func (p *Plugin) Execute() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := p.runJobs(p.Network.Context, client); err != nil {
|
if err := p.runJobs(p.Network.Context, client); err != nil {
|
||||||
return fmt.Errorf("error while creating sync job: %w", err)
|
return fmt.Errorf("error while running jobs: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user