Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

[Android] Inconsistent Base64 encoded response with responseType: blob #219

Open
mrahn24 opened this issue Jan 12, 2022 · 1 comment · May be fixed by #220
Open

[Android] Inconsistent Base64 encoded response with responseType: blob #219

mrahn24 opened this issue Jan 12, 2022 · 1 comment · May be fixed by #220

Comments

@mrahn24
Copy link

mrahn24 commented Jan 12, 2022

Describe the bug
Fetching larger images with responseType 'blob' results in inconsistent base64 encoding between iOS and Android.
iOS: encoded string is just one line
Android: encoded string is wrapped and has multiple lines -> this leads to issues when using it as dataUrl in angular

Android:

/9j/4AAQSkZJRgABAgAAAQABAAD//gAQTGF2YzU4LjU0LjEwMAD/2wBDAAgMDA4MDhAQEBAQEBMS
ExQUFBMTExMUFBQVFRUZGRkVFRUUFBUVGBgZGRscGxoaGRocHB4eHiQkIiIqKiszMz7/xACdAAAB
BQEBAQAAAAAAAAAAAAAFBwQDBgIBAAgBAAMBAQEAAAAAAAAAAAAAAAABAgMEBRAAAQMCAwQGBQkF
BwQDAQEBAQIAESEDBDEScUFhUSIFE5GBsTLBodFyYrLwUiMzFAZCgiRzNOHCFaLxkmNDszVTJaPS
dIPiRBEBAQADAQEAAgIDAQEBAAAAAAERMQJBIRIyUQNhccGBQiL/wAARCAFoAoADASIAAhEAAxEA

iOS:

/9j/4AAQSkZJRgABAgAAAQABAAD//gAQTGF2YzU4LjU0LjEwMAD/2wBDAAgKCgsKCw0NDQ0NDRAPEBAQEBAQEBAQEBASEhIVFRUSEhIQEBISFBQVFRcXFxUVFRUXFxkZGR4eHBwjIyQrKzP/xACvAAACAwEBAQEAAAAAAAAAAAACAQADBAUGBwgBAQEBAQEBAQEAAAAAAAAAAAABAgMEBQYHEAACAQIEAwUGAwUGBQUBAQEAAQIDERIxIQRRBUFhIoFxE7GRFAahMlLBQmLRciMzgpJD8RXw4dIHY6IWJJNUU3M0shEAAgIAAwUHAQcEAgMBAQAAAAECESESA0FhMQRRcRORIgWBsXIjBtEzwTJSofBiQhQ0siThkmP/wAARCAFoAoADASIAAhEAAxEA/

To Reproduce
Steps to reproduce the behavior:

  1. fetch a larger image with responseType: 'blob'
  2. create dataUrl with the returned data
  3. use it in angular as background image through style property
// component.ts
this.backgroundImageUrl = this.domSanitizer.bypassSecurityTrustStyle(`url(${dataUrl}) !important`);

// component.html
<div [style.background-image]="backgroundImageUrl">...</div>
  1. image is not shown in Android due to wrapping

Expected behavior
The base64 encoded result is not wrapped in Android and consistent between the platforms.

Smartphone (please complete the following information):

  • Device: Samsung Galaxy S8
  • OS: Android 9
  • Browser: Chrome
  • Version 97.0.4692.87

Additional context:

@shifenis
Copy link

shifenis commented Apr 4, 2022

Any update about #220 or any workaround?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants