Qcow2 image opens in Firefox instead of downloading

Download link for qcow2 image opens image content directly in browser when using firefox instead of downloading it as a file. Right click and save as… works.
https://docs.nethserver.org/projects/ns8/en/latest/install.html#pre-built-image

3 Likes

Maybe Firefox is instructed by default for “open” that extension rather than save it?

It does seem to be a difference between Firefox and Chrome–for me (on macOS), the latter offers to save it as a download, while the former presents the content in a browser window. But I think it still suggests an erroneous MIME type.

And indeed that is the case; it’s being served as text/plain:

╰─ curl -v -o /dev/null https://distfeed.nethserver.org/ns8-images/ns8-rocky-linux-9-ns8-stable.qcow2                            ─╯
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 104.18.12.192:443...
* Connected to distfeed.nethserver.org (104.18.12.192) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
} [328 bytes data]
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* (304) (IN), TLS handshake, Unknown (8):
{ [19 bytes data]
* (304) (IN), TLS handshake, Certificate (11):
{ [4165 bytes data]
* (304) (IN), TLS handshake, CERT verify (15):
{ [78 bytes data]
* (304) (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* (304) (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=nethserver.org
*  start date: Feb 13 03:04:12 2024 GMT
*  expire date: May 13 03:04:11 2024 GMT
*  subjectAltName: host "distfeed.nethserver.org" matched cert's "distfeed.nethserver.org"
*  issuer: C=US; O=Let's Encrypt; CN=E1
*  SSL certificate verify ok.
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://distfeed.nethserver.org/ns8-images/ns8-rocky-linux-9-ns8-stable.qcow2
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: distfeed.nethserver.org]
* [HTTP/2] [1] [:path: /ns8-images/ns8-rocky-linux-9-ns8-stable.qcow2]
* [HTTP/2] [1] [user-agent: curl/8.4.0]
* [HTTP/2] [1] [accept: */*]
> GET /ns8-images/ns8-rocky-linux-9-ns8-stable.qcow2 HTTP/2
> Host: distfeed.nethserver.org
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/2 200
< date: Mon, 11 Mar 2024 10:19:26 GMT
< content-type: text/plain
< content-length: 1855258624
< last-modified: Fri, 08 Mar 2024 09:28:25 GMT
< x-rgw-object-type: Normal
< etag: "a6f667ba49af880d8a626c7012235f27-354"
< x-amz-request-id: tx00000084dc96a348dc0ce-0065eb05f1-5251abd1-ams3c
< vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
< strict-transport-security: max-age=15552000; includeSubDomains; preload
< x-do-cdn-uuid: 8efb4737-db6d-4033-85ba-1cf7a34742ff
< cache-control: max-age=60
< x-envoy-upstream-healthchecked-cluster:
< cf-cache-status: REVALIDATED
< accept-ranges: bytes
< set-cookie: __cf_bm=zdztQBhOkb8uIc7kcPsXttCQHdOwolbHO2j8y_D1LP8-1710152366-1.0.1.1-H0fZBanVFqqbbAqdwa5tVpqg21nd38AQDEu7TlxyAXd3jOrbAOMC7jKNm5gLrz9pMEH0hmGA8ck9w_cp7ZqnBw; path=/; expires=Mon, 11-Mar-24 10:49:26 GMT; domain=.distfeed.nethserver.org; HttpOnly; Secure; SameSite=None
< server: cloudflare
< cf-ray: 862ace614aba68ca-JAX

Actually no, into settings there’s no specific instruction for qcow2 files.

Thank you for reporting the issue. I changed the CDN file metadata with the correct Content-disposition and Content-type HTTP headers.

2 Likes

Just tried it. Still same behavior. Opens as text and does not download. Cheers

Thank you for reporting it. So the issue could recur each time a new image is published.

I use Ubuntu Mate 22.0 with Firefox. When using Chromium the file downloads fine. So it is probably a Firefox problem.

I reapplied the above workaround to the new images. Please check if the problem is solved.

The fix must be implemented in the image automation scripts, to avoid future problems.

1 Like

Thank you for your quick response. Just tried it and got a tab crash reporter screen
with the following
Gah. Your tab just crashed.
We can help!

Choose Restore This Tab to reload the page.
Going to try the restore

Tried the restore and the file shows again as a text file.
The url is the one provided in the documentation → https://distfeed.nethserver.org/ns8-images/ns8-rocky-linux-9-ns8-stable.qcow2

Sorry, it was the CDN cache! Now it should work.

1 Like

You nailed it ! works a treat now. Thank you for your time and efforts.

3 Likes