File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/main/java/run/halo/s3os Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -91,22 +91,27 @@ public Mono<Attachment> delete(DeleteContext deleteContext) {
9191 return Mono .just (context );
9292 }
9393 var properties = S3OsProperties .convertFrom (deleteContext .configMap ());
94- return Mono .using (() -> buildS3Client (properties ),
94+ return Mono .using (
95+ () -> buildS3Client (properties ),
9596 client -> Mono .fromCallable (
9697 () -> client .deleteObject (DeleteObjectRequest .builder ()
9798 .bucket (properties .getBucket ())
9899 .key (objectKey )
99- .build ())).subscribeOn (Schedulers .boundedElastic ()),
100- S3Client ::close )
100+ .build ())),
101+ S3Client ::close
102+ )
103+ .subscribeOn (Schedulers .boundedElastic ())
101104 .doOnNext (response -> {
102105 checkResult (response , "delete object" );
103106 log .info ("Delete object {} from bucket {} successfully" ,
104107 objectKey , properties .getBucket ());
105108 })
106109 .thenReturn (context );
107110 })
111+ // ignore when the object does not exist
112+ .onErrorComplete (NoSuchKeyException .class ::isInstance )
108113 .onErrorMap (S3ExceptionHandler ::map )
109- .map ( DeleteContext :: attachment );
114+ .thenReturn ( deleteContext . attachment () );
110115 }
111116
112117 @ Override
You can’t perform that action at this time.
0 commit comments