eight04 / image-picka

A Firefox/Chrome extension helping you download images.
MIT License
173 stars 19 forks source link

Send raw URL to downloads API and fetch from cache #330

Open vigilantesculpting opened 1 year ago

vigilantesculpting commented 1 year ago

I have been running Image Picka for some time with the "Try to download image from browser cache" option turned on. This option itself is working fine. The issue is that when I now go to the images in my download history, and right-click & select "Copy Download Link", I get a URL that looks like "blob:moz-extension://..." instead of a proper original URL.

Is there a way to retrieve / convert the original download URL from these blobs? Where do I find the blobs? My google-fu is letting me down, since all I get when I google "moz extension" is a bunch of references to Firefox extensions in general...

Any help would be appreciated!

eight04 commented 1 year ago

Blob URL is a URL pointing to a "blob object", which is a cached image in this case.

The download process looks like this:

  1. The extension looks into the webpage and find all images, extracts their URLs.
  2. The extension sends requests to retrieve cached data. (the cached image)
  3. The extension creates a blob URL pointing to the cached data, then send the blob URL to download manager.

Therefore, the download manager doesn't know the original URL of the image, but only the blob URL.

Is there a way to retrieve / convert the original download URL from these blobs? Where do I find the blobs?

You can't. After downloading complete, the blob is deleted to save memory.


The only way to fix this is to make download manager support downloading from cache, then we don't need the 2nd step and we can send the original URL to download manager directly.

See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1698863

vigilantesculpting commented 1 year ago

Thank you for the clarification. I was kinda expecting as much, given that we are talking about cached images.

PS Also, thanks again for this awesome extension.