Skip to content

Commit 7a6e1c2

Browse files
author
zerox80
committed
fix: update retry logic for cancelled file uploads
- Changed shouldRetry behavior to retry uploads when CancellationException occurs instead of failing - Updated logic in both UploadFileFromContentUriWorker and UploadFileFromFileSystemWorker - This ensures upload tasks can recover from temporary cancellations rather than failing permanently
1 parent de12483 commit 7a6e1c2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

opencloudApp/src/main/java/eu/opencloud/android/workers/UploadFileFromContentUriWorker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ class UploadFileFromContentUriWorker(
382382
private fun shouldRetry(throwable: Throwable?): Boolean {
383383
if (throwable == null) return false
384384
if (throwable is UnauthorizedException || throwable is LocalFileNotFoundException) return false
385-
if (throwable is CancellationException) return false
385+
if (throwable is CancellationException) return true
386386
if (throwable is IOException) return true
387387
return shouldRetry(throwable.cause)
388388
}

opencloudApp/src/main/java/eu/opencloud/android/workers/UploadFileFromFileSystemWorker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class UploadFileFromFileSystemWorker(
359359
private fun shouldRetry(throwable: Throwable?): Boolean {
360360
if (throwable == null) return false
361361
if (throwable is LocalFileNotFoundException) return false
362-
if (throwable is CancellationException) return false
362+
if (throwable is CancellationException) return true
363363
if (throwable is IOException) return true
364364
return shouldRetry(throwable.cause)
365365
}

0 commit comments

Comments
 (0)