Merge pull request #1116 from yuhan6665/fix-base64

Fix base64-url-safe format decode
This commit is contained in:
2dust
2021-06-27 11:52:20 +08:00
committed by GitHub

View File

@@ -102,9 +102,14 @@ object Utils {
try {
return Base64.decode(text, Base64.NO_WRAP).toString(charset("UTF-8"))
} catch (e: Exception) {
e.printStackTrace()
return ""
Log.i(AppConfig.ANG_PACKAGE, "Parse base64 standard failed $e")
}
try {
return Base64.decode(text, Base64.NO_WRAP.or(Base64.URL_SAFE)).toString(charset("UTF-8"))
} catch (e: Exception) {
Log.i(AppConfig.ANG_PACKAGE, "Parse base64 url safe failed $e")
}
return ""
}
/**