You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2022/03/24 05:38:27 UTC
[royale-asjs] branch develop updated: Base64 decoding fixes
This is an automated email from the ASF dual-hosted git repository.
gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new f76c96d Base64 decoding fixes
f76c96d is described below
commit f76c96d1e7c74a3c1175067ee0d4b1d6adcc778d
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Mar 24 18:38:17 2022 +1300
Base64 decoding fixes
---
.../Core/src/main/royale/org/apache/royale/utils/Base64.as | 11 +++++++++--
.../MXRoyaleBase/src/main/royale/mx/utils/Base64Decoder.as | 1 -
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Base64.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Base64.as
index 2cdc2d8..0009b21 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Base64.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Base64.as
@@ -90,8 +90,15 @@ package org.apache.royale.utils
var c2:int;
var c3:int;
var c4:int;
- var i:int = 0;
- var len:int = str.length;
+ var i:int = 0;
+
+ var len:int = str.length;
+ //remove padding:
+ if (len && str.charAt(len-1) == '=') {
+ len--;
+ if (len && str.charAt(len-1) == '=') len--;
+ str = str.substr(0,len);
+ }
var byteString:BinaryData = new BinaryData();
byteString.writeUTFBytes(str);
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/Base64Decoder.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/Base64Decoder.as
index b9a8c25..fa07d4d 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/Base64Decoder.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/Base64Decoder.as
@@ -90,7 +90,6 @@ public class Base64Decoder
public function decode(data:String):String
{
var bytes:BinaryData = Base64.decode(data);
- bytes.readUTFBytes(bytes.length);
decodedString = bytes.readUTFBytes(bytes.length);
return decodedString;
}