Sync shared snapshot from 170a251
This commit is contained in:
1 parent
74afed9a13
commit
4a391392bb
1 file changed
+11
@@ -200,6 +200,17 @@ func (c *Core) thumbnailMediaIdentifier(w http.ResponseWriter, r *http.Request,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var thumbnailID string
|
||||||
|
if err := c.db.QueryRow(r.Context(), `
|
||||||
|
SELECT t.id::text
|
||||||
|
FROM thumbnails t
|
||||||
|
JOIN media m ON m.id = t.media_id OR t.source_path = COALESCE(NULLIF(m.file_path, ''), m.media_key)
|
||||||
|
WHERE m.media_key=$1 OR CAST(m.id AS TEXT)=$1
|
||||||
|
ORDER BY t.created_at DESC
|
||||||
|
LIMIT 1`, id).Scan(&thumbnailID); err == nil && SafeRelative(thumbnailID) {
|
||||||
|
c.carrierNode.Proxy(w, r, "/thumbnails/"+thumbnailID+".jpg")
|
||||||
|
return
|
||||||
|
}
|
||||||
record, err := c.findMedia(r.Context(), id)
|
record, err := c.findMedia(r.Context(), id)
|
||||||
if err != nil || !isImagePath(record.FilePath) {
|
if err != nil || !isImagePath(record.FilePath) {
|
||||||
writeError(w, http.StatusNotFound, "thumbnail not found")
|
writeError(w, http.StatusNotFound, "thumbnail not found")
|
||||||
|
|||||||
Reference in new issue
Block a user