Basically mobile requestUrl
can NOT upload or download “large files” (>=20~50mb).
Reproduce:
-
Download a webdav server, and I use dufs https://github.com/sigoden/dufs
run:
# download the dufs # and run it inside a test folder ./dufs -A --enable-cors --bind 0.0.0.0 --port 8080
-
Add these ribbons to easily tigger the bug on mobile, remember to replace the hard-code LAN address
this.addRibbonIcon( `apple`, `use fetch`, async () => { new Notice(`using fetch. start`) const a = await fetch('http://<my computer lan ip>:8080/random-fetch.bin', { method: 'PUT', body: new ArrayBuffer(100*1024*1024) }) const msg = `using fetch. we finish the upload: status=${a.status}` console.log(msg) new Notice(msg) } ); this.addRibbonIcon( `banana`, `use requestUrl`, async () => { new Notice(`using requestUrl. start`) const a = await requestUrl({ url: 'http://<my computer lan ip>:8080/random-requestUrl.bin', method: 'PUT', body: new ArrayBuffer(100*1024*1024) }) const msg = `using requestUrl. we finish the upload: status=${a.status}` console.log(msg) new Notice(msg) } );
-
Try to click the ribbons on mobile. My iPhone / Android can upload 100mb array buffer using fetch without problems, but cannot upload 100mb using
requestUrl
. Obsidian crashes after I click usingrequestUrl
(the banana ribbon).
I do not have sufficient mobile dev knowledge to debug. But it seems to be a OOM. However I am sure my phone has enough RAM, and fetch
is ok as a proof.
And requestUrl
is still required in my plugin because of the CORS issue. I bypass the CORS issue in above example but that’s not always possible if server is not mime. So hopefully Obsidian dev team can fix this bug.