Ionic native file plugin - file.readAsDataURL returns bad base64 string


#1

Hey.
i diden’t found the issues section in the cordova repo so i am writing it here.
when using the function file.readAsDataURL (which suppose to return the file in base64 encoding) in web and android it works great but in ios it returns a bad base64 string. the string contain many line breaks. the workaround i found is to use:
imageData = imageData.replace(/[\n\r]+/g, ‘’);
in order to correct the base64 string.

without the above, if the file is an image SafeStyle will not be able to present it.

hope it helps.