Skip to content

Commit

Permalink
Fix the problem of not being able to delete if storage was deleted (#28)
Browse files Browse the repository at this point in the history
This PR ignores the error `failed get storage: storage not found; rawPath: ...` while deleting attachments.

Fixes #25 

/kind bug

```release-note
修复因 AList 存储被删除后无法删除附件的问题
```
  • Loading branch information
JohnNiang authored Oct 29, 2024
1 parent aaac41e commit 38b813a
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ public Mono<Attachment> delete(DeleteContext deleteContext) {
})
.flatMap(result -> {
if (!Objects.equals(OK.value(), result.getCode())) {
// According to https://alist.nn.ci/guide/api/fs.html, we have no
// better way to detect whether the storage is not found
if (StringUtils.startsWith(
result.getMessage(), "failed get storage: storage not found"
)) {
// ignore error: storage not found
return Mono.just(attachment);
}
return Mono.error(new ServerWebInputException(
"Failed to delete file: " + result.getMessage())
);
Expand Down

0 comments on commit 38b813a

Please sign in to comment.