Skip to content

Commit

Permalink
Merge pull request #1322 from Infomaniak/fix-apierror-context
Browse files Browse the repository at this point in the history
Fix: The context property from ApiError gives the wrong value
  • Loading branch information
KevinBoulongne authored Jun 4, 2024
2 parents 7556bbc + a4395a3 commit 7b422a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions app/src/main/java/com/infomaniak/drive/data/api/UploadTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.work.workDataOf
import com.google.gson.annotations.SerializedName
import com.google.gson.reflect.TypeToken
import com.infomaniak.drive.data.models.UploadFile
import com.infomaniak.drive.data.models.drive.Drive
import com.infomaniak.drive.data.models.drive.Drive.MaintenanceReason
import com.infomaniak.drive.data.models.upload.UploadSession
import com.infomaniak.drive.data.models.upload.ValidChunks
import com.infomaniak.drive.data.services.UploadWorker
Expand All @@ -48,7 +48,6 @@ import kotlinx.coroutines.*
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withLock
import kotlinx.serialization.json.jsonPrimitive
import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
Expand Down Expand Up @@ -358,7 +357,7 @@ class UploadTask(
"lock_error" -> throw LockErrorException()
"not_authorized" -> throw NotAuthorizedException()
"product_maintenance" -> {
if (error?.context?.get("reason")?.jsonPrimitive?.content == Drive.MaintenanceReason.TECHNICAL.value) {
if (error?.contextGson?.getAsJsonPrimitive("reason")?.asString == MaintenanceReason.TECHNICAL.value) {
throw ProductMaintenanceException()
} else {
throw ProductBlockedException()
Expand Down

0 comments on commit 7b422a9

Please sign in to comment.