Skip to content

[Sentry] Metamask mobile crashes when try to download file #2195

@marcoready

Description

@marcoready

We are developing a dApp using metamask browser extension and we also want to able to use it on metamask mobile browser.
We need to download files on the client-side.
On the desktop the download of the files are working well:

function createDownloadLink(file: File): void {
     const objectURL = URL.createObjectURL(file);
     const link = document.createElement('a');
     link.setAttribute('href', objectURL);
     link.setAttribute('download', file.name as string);
     document.body.appendChild(link);
     link.click();
     document.body.removeChild(link);
     URL.revokeObjectURL(objectURL);
   }

BUT in Metamask mobile just crashes and exits when we click on the download.

We also to refactor to use FileReader instead of URL API (https://developer.mozilla.org/pt-BR/docs/Web/API/FileReader/FileReader) but it still crashes.

Other approaches that we tried was https://www.npmjs.com/package/file-saver and https://github.com/jimmywarting/StreamSaver.js

The stream saver works fine in chrome mobile browser, but not in the metamask mobile browser
Here's there an example
https://jimmywarting.github.io/StreamSaver.js/examples/saving-a-blob.html

Metadata

Metadata

Labels

INVALID-ISSUE-TEMPLATEIssue's body doesn't match any issue template.Sev2-normalAn issue that may lead to users misunderstanding some limited risks they are takingarea-SentryIssue from SentrybrowserRelated to web browser functionality, e.g. HTTP CORS, bookmarking, etc.external-contributorneeds-reproductionregression-prod-7.16.0Regression bug that was found in production in release 7.16.0team-mobile-platformMobile Platform teamtype-bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions