Fortunately, there is a detailed spec for "probably not trust the
mimetype provided by the server". Modern browsers compute the MIME type
based mainly on a combination of the supplied MIME type, and the first
512 bytes of the downloaded resource. <https://mimesniff.spec.whatwg.org
/#determining-the-computed-mime-type-of-a-resource> Oxide probably
follows this spec already. If the download service is restarting the
download (ignoring for the moment the multiple problems with that
approach), it should reimplement that spec.

(One of the problems is, as Chris says, that on the second request, the
server response may be different, so the MIME type you compute may be
different. A pathological example of this would be that the second
serving is of a type where the only installed app that can handle it is
... Browser.)

All that aside, if you tap a link, you expect that it might take a while
(and if it does, the browser will show some kind of waiting indicator).
So the browser can wait for as long as the server takes to begin the
response, read the first 512 bytes, compute the MIME type, and then hand
it off to the download service.

If you choose "Save Link", it's more difficult: people expect some kind
of selection UI within a couple of seconds. So what browsers tend to do
is make the request, wait for a couple of seconds for the server to
start sending the response, and if it does, set up the picker informed
by that response. If the server doesn't respond in time, the browser
sets up the picker informed by what it does know already (mainly the
URL, which isn't worth much).

If the server hasn't responded within a couple of seconds, you could
give it some extra time by putting up a picker containing nothing but a
spinner. That would reassure the user for a couple more seconds, but
after that you would still need to populate the picker with default
choices.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1500742

Title:
  Downloading a file requires its mime-type to be known in advance

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/content-hub/+bug/1500742/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to