feat: store thumbnails in project mounts with legacy fallback
- Add thumbnail upload, lookup, deletion, and scratch-fetch helpers - Distinguish missing mounts from other listing failures
This commit is contained in:
1 parent
483a1a278b
commit
6aec03fb3d
16 files changed
+846
-126
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user