Skip to content

Commit 6d23a6d

Browse files
committed
feat: convert quota to bytes correctly before passing it to the ViewModel
1 parent 7d8fe2d commit 6d23a6d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/createspace/CreateSpaceDialogFragment.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class CreateSpaceDialogFragment : DialogFragment() {
8989
createSpaceButton.setOnClickListener {
9090
val spaceName = createSpaceDialogNameValue.text.toString()
9191
val spaceSubtitle = createSpaceDialogSubtitleValue.text.toString()
92-
val spaceQuota = convertToBytes(createSpaceDialogQuotaValue.toString())
92+
val spaceQuota = convertToBytes(createSpaceDialogQuotaValue.text.toString())
9393

9494
if (isEditMode) {
9595
currentSpace?.let {
@@ -151,8 +151,8 @@ class CreateSpaceDialogFragment : DialogFragment() {
151151
}
152152

153153
private fun convertToBytes(spaceQuota: String): Long {
154-
val quotaNumber = spaceQuota.removeSuffix(" GB").toLongOrNull() ?: return 0L
155-
return quotaNumber * 1_000_000_000L
154+
val quotaNumber = spaceQuota.toDoubleOrNull() ?: return 0L
155+
return (quotaNumber * 1_000_000_000L).toLong()
156156
}
157157

158158
interface CreateSpaceListener {

0 commit comments

Comments
 (0)