Fix ali expection

This commit is contained in:
FongMi 2023-04-28 17:06:25 +08:00
parent 4dc079b93c
commit 78de6ce8cb
3 changed files with 9 additions and 4 deletions

View File

@ -399,17 +399,22 @@ public class API {
} }
private void deleteAll() { private void deleteAll() {
for (String tempId : tempIds) delete(tempId); Iterator<String> iterator = tempIds.iterator();
while (iterator.hasNext()) {
boolean deleted = delete(iterator.next());
if (deleted) iterator.remove();
}
} }
private void delete(String fileId) { private boolean delete(String fileId) {
try { try {
SpiderDebug.log("Delete..." + fileId); SpiderDebug.log("Delete..." + fileId);
String json = "{\"requests\":[{\"body\":{\"drive_id\":\"%s\",\"file_id\":\"%s\"},\"headers\":{\"Content-Type\":\"application/json\"},\"id\":\"%s\",\"method\":\"POST\",\"url\":\"/file/delete\"}],\"resource\":\"file\"}"; String json = "{\"requests\":[{\"body\":{\"drive_id\":\"%s\",\"file_id\":\"%s\"},\"headers\":{\"Content-Type\":\"application/json\"},\"id\":\"%s\",\"method\":\"POST\",\"url\":\"/file/delete\"}],\"resource\":\"file\"}";
json = String.format(json, user.getDriveId(), fileId, fileId); json = String.format(json, user.getDriveId(), fileId, fileId);
String result = auth("adrive/v2/batch", json, true); String result = auth("adrive/v2/batch", json, true);
if (result.length() == 211) tempIds.remove(fileId); return result.length() == 211;
} catch (Exception ignored) { } catch (Exception ignored) {
return false;
} }
} }

Binary file not shown.

View File

@ -1 +1 @@
1da9b9d6b4241ada175c741d4b4b9cf9 9eb909e7a180e28b617c5fd15bda5b22