mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 09:36:08 +00:00
fix: audio asset playback and orphan-cleanup thumbnail deletion
The audio proxy resolved ownership only through voice comments, so R2_AUDIO video assets (which store the same proxy path in videoAsset.sourceUrl) always got 403s. Resolve ownership the way the image proxy does: query comments and video assets, merge into a unique-owning-video map, deny on ambiguity. r2-orphan-cleanup marked videoAsset.sourceUrl as referenced but not videoAsset.thumbnailUrl, so every R2_VIDEO asset thumbnail older than the TTL was deleted as an orphan. Widen the query to both columns. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -119,8 +119,10 @@ async function findReferencedUrls(urls: string[]): Promise<Set<string>> {
|
||||
})
|
||||
: Promise.resolve([] as Array<{ url: string }>),
|
||||
db.videoAsset.findMany({
|
||||
where: { sourceUrl: { in: group } },
|
||||
select: { sourceUrl: true },
|
||||
where: {
|
||||
OR: [{ sourceUrl: { in: group } }, { thumbnailUrl: { in: group } }],
|
||||
},
|
||||
select: { sourceUrl: true, thumbnailUrl: true },
|
||||
}),
|
||||
db.videoVersion.findMany({
|
||||
where: {
|
||||
@@ -142,6 +144,7 @@ async function findReferencedUrls(urls: string[]): Promise<Set<string>> {
|
||||
}
|
||||
for (const row of assetRows) {
|
||||
if (row.sourceUrl) referenced.add(row.sourceUrl);
|
||||
if (row.thumbnailUrl) referenced.add(row.thumbnailUrl);
|
||||
}
|
||||
for (const row of versionRows) {
|
||||
if (row.originalUrl) referenced.add(row.originalUrl);
|
||||
|
||||
Reference in New Issue
Block a user