Bug: mobile `requestUrl` has performance issue

Basically mobile requestUrl can NOT upload or download “large files” (>=20~50mb).

Reproduce:

  1. 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
    
  2. 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)
      }
    );
    
  3. 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 using requestUrl (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.

Moved to developers and api

hi may i ask are there any obsidian devs would like to check out this bug in near future? thanks

Unfortunately this won’t be fixed anytime soon.

On mobile, the data is sent to the backend via base64 because our app to native interface can’t pass byte arrays.