ipfs-webui icon indicating copy to clipboard operation
ipfs-webui copied to clipboard

File → menu → Download buffers entire file into a blob

Open ZeroCool22 opened this issue 2 years ago • 6 comments

  • OS: Windows 10 x64
  • Version of IPFS Desktop [0.18.1]

Describe the bug

https://streamable.com/9z175t

To Reproduce Steps to reproduce the behavior:

  1. Go to the file
  2. Click on more
  3. Scroll down to Download
  4. Blank Screen after some seconds.

Log files:

combined.log error.log

PD: I tried reinstalling, but same problem.

ZeroCool22 avatar Jan 09 '22 04:01 ZeroCool22

Hi @ZeroCool22! Thanks for the bug report. I could not reproduce it, which makes me think it may be related to RAM memory. I see you have 32 GB of RAM and that it reaches ~60% usage before crashing. How large is the file? Could you also try checking the developers console when it happens (CTRL+SHIFT+I)?

hacdias avatar Jan 10 '22 12:01 hacdias

Hi @ZeroCool22! Thanks for the bug report. I could not reproduce it, which makes me think it may be related to RAM memory. I see you have 32 GB of RAM and that it reaches ~60% usage before crashing. How large is the file? Could you also try checking the developers console when it happens (CTRL+SHIFT+I)?

Here you go:

https://streamable.com/u0kchy

ZeroCool22 avatar Jan 10 '22 18:01 ZeroCool22

No help?

I really want to use IPFS... :(

ZeroCool22 avatar Jan 11 '22 02:01 ZeroCool22

@ZeroCool22 thank you for recording the demo, it is very useful. We will fix this, but for now you need to use a workaround: avoid using the "Download" ("Descarga") action from menu, and click on "Local gateway" instead:

2022-01-11_23-25

Let us know if this works with your 7GB file.


@hacdias my understanding of the problem is that we need to change how "Download" context action of a single file is implemented on the Files screen. It reads correct URL from doFilesDownloadLink but then downloads it using downloadFile function from src/files/download-file.js, which buffers the entire thing in memory to construct a blob:.

I believe creating a blob via window.URL.createObjectURL in downloadFile was necessary because we did not have ?download=true four years ago (was introduced in 2020 in https://github.com/ipfs/go-ipfs/pull/7677), and we also displayed progress bar or something.

Today it is not necessary, and as we can see harms UX when a big file is downloaded. We should remove blob freation and leverage regular URL with added download=true parameter instead. Code for tracking download progress also should be removed – browser will handle that.

Will you have time to submit a fix?

lidel avatar Jan 11 '22 22:01 lidel

@lidel I think one of the issues is the directory: there's no way of downloading a directory via the gateway and the API is POST only (unless that changed recently)

Ref https://github.com/ipfs/go-ipfs/issues/7746

hacdias avatar Jan 14 '22 09:01 hacdias

@hacdias afaik /api/v0/get is also exposed on Gateway port, and there it should accept GET (POST restriction applies only to the RPC API port).
I think is fine to use that until we have a better way for fetching directories on Gateways.

lidel avatar Jan 16 '22 02:01 lidel

:tada: This issue has been resolved in version 2.21.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

ipfs-gui-bot avatar Dec 09 '22 23:12 ipfs-gui-bot