Images from cloud storage direct download links are not shown in Quarto HTML document

Problem

Quarto HTML document does not display images from external direct download links to a publicly accessible cloud share provider (in this case Keeper, based on Seafile).
The problem does not occur for e.g., the GitHub README.md file.

Demonstration

A demonstration of the problem can be found here: https://lennartwittkuhn.com/keeper-image/.

Quarto version

On my local machine:

$ quarto --version
1.2.313

Any hints appreciated! Thank you!

The direct download link you used https://keeper.mpdl.mpg.de/f/ec510a79d3ab495eaf67/?dl=1 is a link with redirect.

it seems that Pandoc won't follow redirect and will do the same as in a browser. If I paste the link inside the browser I can this page https://keeper.mpdl.mpg.de/f/ec510a79d3ab495eaf67/?dl=1.png

While the SVG file is correctly downloaded to. It seems Github markdown preview will follow redirect, hence why it works

$ curl -I https://keeper.mpdl.mpg.de/f/ec510a79d3ab495eaf67/?dl=1
HTTP/1.1 302 Found
server: nginx
date: Mon, 06 Mar 2023 10:45:28 GMT
content-type: text/html; charset=utf-8
content-length: 0
location: https://keeper.mpdl.mpg.de/seafhttp/files/2e75692d-e929-4380-93ba-83c01c307c3f/KeeperLogo.svg
vary: Cookie, Accept-Language
content-language: en
set-cookie: sfcsrftoken=CML25R0X8h6r8UasyuBfNcxZCWmKSI8Ty6VUzBLRDcXx7iD95qBciQaPGvYjysGj; expires=Mon, 04 Mar 2024 10:45:28 GMT; Max-Age=31449600; Path=/; SameSite=Lax
strict-transport-security: max-age=31536000; includeSubdomains
set-cookie: SERVERID=app09-keeper.mpdl.mpg.de; path=/

Now if I follow the redirect in the URL provided I correctly get the SVG image

$ curl -I -L https://keeper.mpdl.mpg.de/f/ec510a79d3ab495eaf67/?dl=1
HTTP/1.1 302 Found
server: nginx
date: Mon, 06 Mar 2023 10:49:24 GMT
content-type: text/html; charset=utf-8
content-length: 0
location: https://keeper.mpdl.mpg.de/seafhttp/files/b7bbab02-a94e-4fe2-82a5-7d2cb1e7b24c/KeeperLogo.svg
vary: Cookie, Accept-Language
content-language: en
set-cookie: sfcsrftoken=T2Pg90JHul53lqcSHaoVG7ylphXcQqu3jNYqlrbfRMmO4dYwL50MpawXjqMsis1m; expires=Mon, 04 Mar 2024 10:49:24 GMT; Max-Age=31449600; Path=/; SameSite=Lax
strict-transport-security: max-age=31536000; includeSubdomains
set-cookie: SERVERID=app07-keeper.mpdl.mpg.de; path=/

HTTP/1.1 200 OK
server: nginx
date: Mon, 06 Mar 2023 10:49:24 GMT
content-type: image/svg+xml
content-length: 6202
last-modified: Mon, 06 Mar 2023 10:49:24 GMT
cache-control: max-age=3600
access-control-allow-origin: *
content-security-policy: sandbox
content-disposition: attachment;filename*="utf-8' 'KeeperLogo.svg"
x-content-type-options: nosniff
strict-transport-security: max-age=31536000; includeSubdomains
set-cookie: SERVERID=app09-keeper.mpdl.mpg.de; path=/
cache-control: private

I don't know if and where we could detect 302 redirect and replace the url instead of the user. I'll open an issue about this.

Hi @cderv, thank you so much for your response and looking into this!

I would be fine with replacing / modifying the URL, but I couldn't find a way how to.

I rely on this approach quite a lot (i.e., uploading static files to a cloud share and embedding them via links) to avoid bloating my repositories, so a solution would be brilliant.

BTW, providing a direct download link to an image works when using the About Pages and specifying image in the YAML header.

I've updated the example website to demonstrate this aspect.

Does this correctly suggest that Quarto uses a different download method for links in the YAML header compared to links inside the document?

Thanks again for your help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Yes - I think the image field it handled by Quarto where we download the image, whereas when in a link, this is a Pandoc issue where the download happens but without redirect it seems.

A workaround for a project would be Project script that you could run once in a while, or as a pre render script, to download and update the image locally to the project. Not as good as linking to those, but we need to either make it happen in Quarto, or Pandoc should solve this.

Thanks @cderv for the response!

In the meantime, I have indeed implemented the workaround that you suggested, using a pre-render script (as described in the corresponding issue).

1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.