Skip to content

Commit

Permalink
fix base64 decode bug
Browse files Browse the repository at this point in the history
  • Loading branch information
👾 AMIR ABBAS NAGHDI committed Apr 27, 2022
1 parent 4a608e9 commit 4d30c0b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ buildscript {
ext {
minV = 15
targetV = 31
vCode = 155
vName = "1.5.5"
vCode = 156
vName = "1.5.6"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object Base64Utils {
fun decode(base64: String): String {
val decodeString = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
getDecoder().decode(base64)
else Base64.decode(base64, Base64.DEFAULT)
else Base64.decode(base64, Base64.URL_SAFE or Base64.NO_PADDING or Base64.NO_WRAP)

return String(decodeString, Charsets.UTF_8)
}
Expand Down
4 changes: 3 additions & 1 deletion sample/src/main/java/com/aaaamirabbas/sample/ReactorUtils.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.aaaamirabbas.sample

import com.aaaamirabbas.reactor.handler.Reactor
import com.aaaamirabbas.reactor.helper.Base64Utils

class ReactorUtils(private val reactor: Reactor) {
fun add() {

fun add() {
reactor.put("name", "abbas")
reactor.put<Int>("age", null)
reactor.put("life", 1L)
Expand Down

0 comments on commit 4d30c0b

Please sign in to comment.