attachments: don't break build if directory wasn't found #480

This commit is contained in:
Sören Weber 2023-02-19 22:00:09 +01:00
parent 686c013ef5
commit 472176a88c
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -39,6 +39,7 @@
{{- $filesName = "files" }} {{- $filesName = "files" }}
{{- end }} {{- end }}
{{- $dir := printf "%s%s" $fileDir $filesName }} {{- $dir := printf "%s%s" $fileDir $filesName }}
{{- if fileExists $dir }}
{{- range sort (readDir $dir) "Name" $sort }} {{- range sort (readDir $dir) "Name" $sort }}
{{- if findRE $pattern .Name}} {{- if findRE $pattern .Name}}
{{- $size := .Size }} {{- $size := .Size }}
@ -58,6 +59,7 @@
<li><a href="{{ $link }}">{{.Name}}</a> ({{$size}} {{$unitsymbol}})</li> <li><a href="{{ $link }}">{{.Name}}</a> ({{$size}} {{$unitsymbol}})</li>
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}
</ul> </ul>
{{- $content }} {{- $content }}
</div> </div>