Download attachments for current file should download links to images in properties

Use case or problem

I’m using a combination of Web Clipper and Bases to clip web pages to my vault and view/organize them using Bases. Part of my Web Clipper template includes a link to an image, which looks something like this when it’s added to Obsidian.

banner: "https://cf.geekdo-images.com/kjCm4ZvPjIZxS-mYgSPy1g__opengraph/img/QryNeb0O2AHNe521HAsddL3E8Wg=/0x0:1680x882/fit-in/1200x630/filters:strip_icc()/pic7013651.jpg"

I’d like these images to be downloaded to my vault so I can view the images without an internet connection. When I run the “Download attachments for current file” command in Obsidian, no attachments are found.

Proposed solution

The “Download attachments for current file” command should also look at links in properties, check to see if they link to an image, and if they do, include it in the list of potential images to download.

The check to see if it’s an image or not could be accomplished in one of several ways, here are a few I thought of.

  1. End of link ends in .png, .jpeg, etc.
  2. Make network request for link and check “Content-Type” header of response.

Current workaround (optional)

I don’t have any workarounds right now. I may end up writing a plugin or Templater script to handle downloading images in properties.

6 Likes

Seconding this. I had no reason to really care about cover images until Bases, and now these external links in properties really irk me. :slight_smile:

4 Likes

+1 for this!

It works for me on 1.9.6.

2 Likes

Looks like it was introduced in 1.9.5.

The “Download attachments for current file” command now downloads attachments from file properties in addition to the note body.

Tested on my end and it works for me as well. Thank you Obsidian team!

It still doesn’t work for all image links unfortunately, particularly links containing parameters. For example, this is correctly detected:

![](https://example.com/image.jpg?a=b)

But this is not:

---
cover: https://example.com/image.jpg?a=b
---
1 Like

The someone one is not valid YAML.

It’s valid YAML. I didn’t write it by hand, it’s what the properties editor generated by default. But that’s besides the point: I can also put quotes around it, add escapes, etc. and it still won’t make any difference. The frontmatter above also works in the Cards layout in Bases as the cover image.

I think the problem here is that Obsidian is inferring the content type of the URL by parsing it. A more robust method would be to perform a HEAD request to the URL and check the returned Content-Type header. This method is also cheap, it will only return the headers not the entire body.

yes, I am sorry for the confusion

Please, open a separate feature request for this for this.