base64 decoding with "atob" does not consider web safe base64 encoding in Deno Gmail API Client #19546
Labels
triage required 👀
Deno team needs to make a decision if this change is desired
web
related to Web APIs
Using https://googleapis.deno.dev/v1/gmail:v1.ts by @lucacasonato , the decodeBase64 function calls the built-in "atob". However, the mail parts in Gmail multipart messages are in a different RFC standard base64 encoding (RFC 4648), so attempting to get messages using this client fails with:
Normally the workaround would be something like
replaceAll("-", "+").replaceAll("_", "/")
on the string before passing toatob
, but since this is nested deeply in the generated api client, it's not possible.See https://stackoverflow.com/questions/24812139/base64-decoding-of-mime-email-not-working-gmail-api for other discussion.
I'm not sure if this is the correct place to report this, but the client makes no reference to any issue tracker and I cant find any tests for it, so I went by @lucacasonato as the author and he is a core contributor here.
The message I am testing against, which is a publicly available reply on another repo here on Github, sent as an email. This is the "data" variable that is passed as deserializeMessage(data) in usersMessagesGet.
You can see the base64 data returned from gmail is not compatible with denos
atob
function that is used in the API Client for gmail.Full data here:
The text was updated successfully, but these errors were encountered: