[Bug fix] increase robustness of feat_img process pipeline #802
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
复现
将
exampleSite
下的config.toml
的中文配置删除(279-521行),构建时就会出现以下报错。bug原因
exampleSite
下的create-diagrams内的参数featureImage
为空,理论上来说按照single.html
所使用的with
方法这个空参数是不会被传入的,但我看作者您在这里貌似使用了一些其他的处理方式让这个空值也会被传入,从而导致Hugo
无法获取到资源的宽度从而报错。修复方法
加了一个判断文件类型的逻辑,只有检测到输入为图片时才会进行后续操作。