Leworoe / thunderbird-outlook-appointment

Get the hidden appointment from an email from outlook/teams as a .ics-file
https://addons.thunderbird.net/de/thunderbird/addon/outlook-teams-appointments/
MIT License
14 stars 3 forks source link

Crashes, when ics-string isn't base64 encoded #12

Open testtomat opened 1 year ago

testtomat commented 1 year ago

I found this solution:

use try/catch

function base64ToText(base64String) {

try { 

 const binaryString = atob(base64String);
  const codePoints = Array(binaryString.length);
  for (let index = 0; index < binaryString.length; index++)
    codePoints[index] = binaryString.codePointAt(index);
  const uint8CodePoints = Uint8Array.from(codePoints);
  return new TextDecoder().decode(uint8CodePoints);

catch(e) {
  return base64String;
}
}