Project

General

Profile

Actions

Feature #565

open

See if it is possible to download a file contained in a blob

Added by Philippe Monroux over 4 years ago. Updated 10 months ago.

Status:
New
Priority:
3.x
Start date:
05/03/2020
Due date:
% Done:

0%

Estimated time:

Description

la page :

https://media.interieur.gouv.fr/deplacement-covid-19/

génère un fichier PDF que l'on doit pouvoir enregistrer dans la mémoire du téléphone. Avec privacy browser on ne peut pas l'enregistrer car cela signale "invalid url" dans la boîte de dialogue de l'enregistrement du fichier

Actions #1

Updated by Soren Stoutner over 4 years ago

I do not speak the language this is written in (perhaps French?). Can you please repost it in English?

Actions #2

Updated by Pure Incompetence over 4 years ago

Translation from deepl.com/translate :

The Webpage
https://media.interieur.gouv.fr/deplacement-covid-19/
generates a PDF file that you should be able to save in the phone memory. With privacy browser it cannot be saved because it signals "invalid url" in the file saving dialog box.

Actions #3

Updated by Soren Stoutner over 4 years ago

  • Subject changed from impossibilité d'enregistrer un fichier PDF généré par une page web to Files contained in blob's instead of normal URLs cannot be downloaded.
  • Status changed from New to Closed

The problem is caused by the poor website design, which attempts to contain the PDF in a blob, as can be seen in the generated URL: blob:https://media.interieur.gouv.fr/.

Android's WebView doesn't provide any way to turn a blob into a file (this is really poor web design). As such, any browser based on WebView will not be able to download this file. For example, Lightning attempts to download the file, but nothing happens. FOSS Browser crashes if the download is attempted.

Actions #4

Updated by Soren Stoutner over 4 years ago

  • Subject changed from Files contained in blob's instead of normal URLs cannot be downloaded. to Files contained in blobs instead of normal URLs cannot be downloaded.
Actions #5

Updated by Soren Stoutner over 4 years ago

  • Tracker changed from Bug to Feature
  • Subject changed from Files contained in blobs instead of normal URLs cannot be downloaded. to See if it is possible to download a file contained in a blob.
  • Status changed from Closed to New

It should be possible to extract the URL, but I don't know if it will work in the case of this specific website unless it contains more than just the domain name.

Actions #6

Updated by Soren Stoutner almost 4 years ago

At a minimum, this will become possible with the release of Privacy WebView in the 4.x series. But it might be possible to extract this information from DOM storage somehow.

Actions #7

Updated by Anonymous over 3 years ago

I have faced the same error in "Snapdrop" (https://github.com/RobinLinus/snapdrop).

I made some tests, too.

A lot of browsers in the F-Droid store seem to have similar problems with this type of download; in short, they can't download the files.

But... It works just fine with the Android versions of Firefox & Chrome.

Actions #8

Updated by Soren Stoutner over 3 years ago

Firefox and Chrome (and browsers based on them) can download blobs because they can walk the DOM tree and extract the blob. But Android's System WebView does not expose the DOM in the same way, so browsers that are based on WebView, like Privacy Browser and a number of other browsers on F-Droid, cannot download blobs.

Actions #9

Updated by Soren Stoutner about 1 year ago

  • Subject changed from See if it is possible to download a file contained in a blob. to See if it is possible to download a file contained in a blob
Actions #10

Updated by ask low 10 months ago

I've saw some closed source wrappers able to download the blob not sure how, but the file name was some random string, with .bin extension (which can be fixed by renaming it to it's source name & extension).

Actions #11

Updated by Soren Stoutner 10 months ago

https://fonts.google.com/icons is another good test site.

Actions #12

Updated by ask low 10 months ago

The google icons website you've provided, are obviously blobs. But when I tested my proton drive downloads, they're considered blobs too. But strangely they aren't.

For instance, there's a closed source chinese browser called Via was able to download proton drive files. When analysed the file url it shows as data instead of blob. Here's the url form
data:application/zip;base64,<some-long-data-string>==

Actions #13

Updated by Soren Stoutner 10 months ago

Sounds like Proton Drive sometimes presents as data URLs and other times as blob URLs. Servers can choose to do things like that if they want to. It might depend on how the browser presents itself, like the User Agent or some other behavior.

Actions #14

Updated by ask low 10 months ago

I don't think it's sometimes. It's everytime, always has been data URL in proton. But PB's considering data as blob too. You can try data URLs on other wrappers, & then in PB to look into the difference.

Actions #15

Updated by Soren Stoutner 10 months ago

Thinking about it a little bit more, when you download something from a blob (a storage location in the DOM accessed by JavaScript) it contains a data URL with the actual item. So, to be able to handle downloading of blobs you first must be able to walk the DOM to find the blob, then you must convert the data URL it contains into the file you want to save.

Privacy Browser Android already knows how to convert data URLs into files and save them. But because Android's WebView does not provide a built-in downloader, and because it does not expose the DOM in a way that is easy to walk to find the blob, that is the step where downloading blobs breaks down for browsers based on WebView.

There might be some way to walk the tree and extract the data URL from the blob using JavaScript injection. When I get around to looking deeply at this feature I am going to take the time to explore that. Otherwise, it will probably have to wait for the 4.x series.

Actions #16

Updated by Soren Stoutner 10 months ago

Or, you know, you could always submit a feature request to Proton Drive to present their file downloads as actual https URLs (best, in my opinion), or as data URLs (second best) instead of wrapping them in a blob.

Actions #17

Updated by ask low 10 months ago

Their public forum is very pathetic actually. Neither do they have an issue tracker, nor their app in f-droid either. It's a shame they're been promoted as the no. 1 swiss service.

Actions

Also available in: Atom PDF