Prevents calling of remote broken image resources from crashing a site build; the worst-case scenario is you'd just get a broken image tag.
Screenshots (if applicable)
N/A really.
Testing
The only context in which the code change should affect anything is when you reference an image with a full URL that leads to a 404, like https://example.com/doesnotexist.png.
Whereas before it would try to evaluate the result, Hugo will choke if the result is empty. So now it first checks to see if the result exists, and only if it does will it evaluate it.
If you're looking directly at the code, GitHub's diffs might be confusing. I really just wrapped what was already there using {{- with $image }}.
Checklist
Ensure you have checked off the following before submitting your PR.
This PR...
Changes / fixes
Screenshots (if applicable)
N/A really.
Testing
The only context in which the code change should affect anything is when you reference an image with a full URL that leads to a 404, like
https://example.com/doesnotexist.png
.Whereas before it would try to evaluate the result, Hugo will choke if the result is empty. So now it first checks to see if the result exists, and only if it does will it evaluate it.
If you're looking directly at the code, GitHub's diffs might be confusing. I really just wrapped what was already there using
{{- with $image }}
.Checklist
Ensure you have checked off the following before submitting your PR.