• Documentation
  • Workato Blog
  • Product Blog
  • Return to Workato
  • Login
  • Automation Institute
  • Documentation
  • Community Forums
New Topic
Discussions Enhancement Requests Core Product Features
R

RK

started a topic almost 6 years ago
In Progress

decode_base64 BROKEN!

<string>.decode_base64 results in an the Hex representation, NOT the original string.

Easiest test, log this:

"test".encode_base64.decode_base64

This should give you "test" but gives you "0x74657374"



Allan Teng

said almost 6 years ago

It looks like we have to force encoding, which requires an enhancement. We have just informed our product team who will keep you posted here.

K

Kai

said almost 6 years ago

Hi Rickmer, 


May I know what is the exact scenario you are looking to decode an encoded data? 

If you are just looking to encode and decode string pills, we have a proposed workaround: 

in formula mode, use 


" "+ "test".encode_base64.decode_base64


this will force explicit encoding of string in utf-8 format and then return the string after decoding. Hope this help!

R

RK

said almost 6 years ago

Hi Kai,


I want to decode the "raw" field of a Gmail message. This needs to be done using "Web Safe" Base64 (i.e. RFC 4648 standard).


See the Gmail API here, look for the "raw" field:


https://developers.google.com/gmail/api/v1/reference/users/messages


Thanks!

Rickmer





C

Chandra Vippena

said almost 6 years ago

Hi Rickmer,


Now you can use the following methods:


1.  as_string('utf-8') - ex: "Test".encode_base64.decode_base64.as_string('utf-8') # Test

2.  as_utf8  - ex:"Test".encode_base64.decode_base64.as_utf8 # Test


If you are using as_string method, encoding style is required.

Hope this helps.

R

RK

said almost 6 years ago

Still not working, because what we need is "Web Safe" Base64 (i.e. RFC 4648 standard). This base64 decoding doesn't conform, it needs to be base64URL. Please have a look at the Gmail API (see above). The message "raw" ist decoded e.g. in Java:


    byte[] emailBytes = base64Url.decodeBase64(message.getRaw());


R

RK

said almost 6 years ago

Not sure why this shows as "implemented", this is still broken...

C

Chandra Vippena

said almost 6 years ago

Hello RK,


Workato Gmail Connector Mail response is either plain text or HTML text.

How are you getting the raw data? Are you trying with HTTP Connector or Custom adapter?


Between, Our team is implementing a formula "decode_urlsafe_base64" for URL safe. We will update you once ready.

In general, the as_utf8 and as_string('utf8') formulae works with Normal text. So, I marked as implemented.


Thanks

Chandra


R

RK

said almost 6 years ago

I use HTTP OAuth2. The fix is very easy - I have written my own workaround, see recipe #523553. Maybe that helps

Login to post a comment

Still can't find your solution?

Send us a ticket, we will try our best to assist you with your problem

Documentation
Developer's Library
Tutorials
eBooks
Product Hour
Product Blog
Workato Blog
Product updates
Customer Stories
© Workato 2022   Privacy   Terms   +1 (844) 469-6752
  • Documentation
  • Workato Blog
  • Product Blog
  • Solutions
  • Forums
  • Tickets
  • Log in
  • Return to Workato
Topic views count