preview: support skipping over single missing images inside large albums

This commit is contained in:
mappu 2023-05-20 13:50:46 +12:00
parent b146db9d0a
commit ea1309eb75

View File

@ -109,8 +109,27 @@ html, body {
m, err := this.Metadata(fileID)
if err != nil {
if os.IsNotExist(err) {
http.Error(w, "Not found", 404)
return
// If this is just one image out of many, show a 404 box and continue to show the other entries
// But if this is only a single image requested, abandon the whole pageload
if len(fileIDs) == 1 {
http.Error(w, "Not found", 404)
return
}
tmpl += `
<div class="entry">
<div class="thumbnail">
<img loading="lazy" src="/nothumb_340.png"></a>
</div>
<div class="properties">
Requested ID ` + html.EscapeString(fileID) + ` not found in storage (404)
</div>
</div>
`
continue
}
log.Println(err.Error())