feat(media): support project-mounted thumbnail storage

- Store thumbnails in project mounts
- Fall back to legacy paths when reading or deleting
- Use original images when stored thumbnails are missing
This commit is contained in:
Gabriel20xx committed 2026-10-14 09:25:40 +00:00
1 parent 0783b74da7
commit c9fc3abcad
3 files changed
+286 -5

No files matched your search

+6 -5
View File
@@ -198,9 +198,7 @@ func (c *Core) thumbnailMediaIdentifier(w http.ResponseWriter, r *http.Request,
return
}
if !strings.Contains(id, string(filepath.Separator)) && !strings.Contains(id, "/") {
thumbnailPath := "/thumbnails/" + id + ".jpg"
if exists, _, _, err := c.carrierNode.Probe(r.Context(), thumbnailPath); err == nil && exists {
c.carrierNode.Proxy(w, r, thumbnailPath)
if c.carrierNode.ProxyThumbnail(w, r, c.serviceName, id) {
return
}
}
@@ -212,8 +210,11 @@ func (c *Core) thumbnailMediaIdentifier(w http.ResponseWriter, r *http.Request,
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
// A row whose file CarrierNode no longer has falls through to the original image below,
// rather than proxying CarrierNode's 404.
if c.carrierNode.ProxyThumbnail(w, r, c.serviceName, thumbnailID) {
return
}
}
record, err := c.findMedia(r.Context(), id)
if err != nil || !isImagePath(record.FilePath) {