preview: support skipping over single missing images inside large albums
This commit is contained in:
parent
b146db9d0a
commit
ea1309eb75
19
preview.go
19
preview.go
@ -109,10 +109,29 @@ html, body {
|
|||||||
m, err := this.Metadata(fileID)
|
m, err := this.Metadata(fileID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
|
||||||
|
// 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)
|
http.Error(w, "Not found", 404)
|
||||||
return
|
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())
|
log.Println(err.Error())
|
||||||
http.Error(w, "Internal error", 500)
|
http.Error(w, "Internal error", 500)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user