Skip to content

Commit 9f8b052

Browse files
committed
Fix free space reporting for SAF backend
1 parent c863695 commit 9f8b052

File tree

1 file changed

+3
-3
lines changed
  • core/src/main/java/org/calyxos/seedvault/core/backends/saf

1 file changed

+3
-3
lines changed

core/src/main/java/org/calyxos/seedvault/core/backends/saf/SafBackend.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import android.provider.DocumentsContract
1313
import android.provider.DocumentsContract.Root.COLUMN_AVAILABLE_BYTES
1414
import android.provider.DocumentsContract.Root.COLUMN_ROOT_ID
1515
import android.provider.DocumentsContract.renameDocument
16-
import androidx.core.database.getIntOrNull
16+
import androidx.core.database.getLongOrNull
1717
import androidx.documentfile.provider.DocumentFile
1818
import io.github.oshai.kotlinlogging.KLogger
1919
import io.github.oshai.kotlinlogging.KotlinLogging
@@ -75,8 +75,8 @@ public class SafBackend(
7575
rootUri, projection, "$COLUMN_ROOT_ID=?", arrayOf(rootId), null
7676
)?.use { c ->
7777
if (!c.moveToNext()) return@use null // no results
78-
val bytes = c.getIntOrNull(c.getColumnIndex(COLUMN_AVAILABLE_BYTES))
79-
if (bytes != null && bytes >= 0) return@use bytes.toLong()
78+
val bytes = c.getLongOrNull(c.getColumnIndex(COLUMN_AVAILABLE_BYTES))
79+
if (bytes != null && bytes >= 0) return@use bytes
8080
else return@use null
8181
}
8282
// if we didn't get anything from SAF, try some known hacks

0 commit comments

Comments
 (0)