This works fine for me:
{{ $url1 := "https://upload.wikimedia.org/wikipedia/commons/a/a5/Red_Kitten_01.jpg" }}
{{ with try (resources.GetRemote $url1) }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ end }}
{{ end }}
This does not:
{{ $url2 := "https://octodex.github.com/images/stormtroopocat.jpg" }}
{{ with try (resources.GetRemote $url2) }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ end }}
{{ end }}
Here an error is thrown:
ERROR template: _shortcodes/bild.html:10:22: executing "_shortcodes/bild.html" at <resources.GetRemote>: error calling GetRemote: failed to resolve media type for remote resource "https://octodex.github.com/images/stormtroopocat.jpg"
The media type for both files is exactly the same:
curl -s -I https://upload.wikimedia.org/wikipedia/commons/a/a5/Red_Kitten_01.jpg https://octodex.github.com/images/stormtroopocat.jpg | grep content-type:content-type: application/javascript; charset=utf-8
content-type: image/jpeg
content-type: image/jpeg
What’s wrong with the second image? How can I avoid the error?