diff --git a/src/main/java/run/halo/app/handler/file/UpOssFileHandler.java b/src/main/java/run/halo/app/handler/file/UpOssFileHandler.java index f07453de6..5a581ed46 100644 --- a/src/main/java/run/halo/app/handler/file/UpOssFileHandler.java +++ b/src/main/java/run/halo/app/handler/file/UpOssFileHandler.java @@ -138,11 +138,12 @@ public class UpOssFileHandler implements FileHandler { try { Response result = manager.deleteFile(key, null); - HashMap respondBody = JsonUtils.jsonToObject(result.body().string(), HashMap.class); - if (!result.isSuccessful() - && !(result.code() == 404 && respondBody.get("code").equals(40400001))) { - log.warn("附件 " + key + " 从又拍云删除失败"); - throw new FileOperationException("附件 " + key + " 从又拍云删除失败"); + if (result.code() != 200) { + HashMap respondBody = JsonUtils.jsonToObject(result.body().string(), HashMap.class); + if (!(result.code() == 404 && respondBody.get("code").equals(40400001))) { + log.warn("附件 " + key + " 从又拍云删除失败"); + throw new FileOperationException("附件 " + key + " 从又拍云删除失败"); + } } } catch (IOException | UpException e) { e.printStackTrace();