fix: download 404, next/image thumbnail 400, and cross-album search

Three production bugs on redaktionen.leon-tonhaeuser.de:

1. Download 404 (POST /api/download-intents → 404). getAlbum requested
   ?withoutAssets=true, so album.assets was always empty and the usages
   membership check (album.assets.some(id)) always failed → ASSET_NOT_IN_ALBUM
   → 404. Same root cause broke bulk-download's assetToGrantedAlbum map.
   Removed withoutAssets so consumers that authorize via album.assets get the
   real list; grants/thumbnail consumers ignore the extra data.

2. _next/image 400 on thumbnail proxy. next/image's optimizer choked on the
   watermarked streaming thumbnail response. Thumbnails are already
   server-resized to 800px, so the optimizer added nothing — switched
   leuchtkasten + admin AlbumGrid to plain <img>, matching photo-gallery.

3. Cross-album search "finds nothing". Immich albumIds is AND across albums
   (PR #18985): one /search/metadata call with all granted ids requires the
   asset to be in EVERY album, so single-album photos never match. Album-
   internal search passed one id so it worked. Fan out per granted album and
   merge; callers already paginate in-app.

Also drop the jahr filter from the album-internal search form (unnecessary
within a single album); backend still honors a jahr query param.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Leon TonhäuserandClaude committed 2026-08-11 14:12:19 +02:00
1 parent f1ed89ea67
commit 962e2c7dc2
5 files changed
+71 -40

No files matched your search

+2 -14
View File
@@ -58,7 +58,7 @@ export default async function AlbumPage({ params, searchParams }: AlbumPageProps
Alle Alben
</Link>
</PageHeader>
<AlbumSearchForm albumId={result.album.id} query={query} format={format} jahr={jahr} />
<AlbumSearchForm albumId={result.album.id} query={query} format={format} />
<p aria-live="polite" className="result-summary" role="status">
{formatCount(result.page.total, "Foto")} gefunden
</p>
@@ -81,10 +81,7 @@ export default async function AlbumPage({ params, searchParams }: AlbumPageProps
);
}
function AlbumSearchForm({ albumId, query, format, jahr }: { albumId: string; query: string; format?: string; jahr?: string; }) {
const currentYear = new Date().getFullYear();
const years = Array.from({ length: 10 }, (_, i) => currentYear - i);
function AlbumSearchForm({ albumId, query, format }: { albumId: string; query: string; format?: string; }) {
return (
<form
action={`/redaktion/alben/${albumId}`}
@@ -112,15 +109,6 @@ function AlbumSearchForm({ albumId, query, format, jahr }: { albumId: string; qu
<option value="hoch">Hochformat</option>
</select>
</label>
<label className="album-search-select">
<span>Jahr</span>
<select name="jahr" defaultValue={jahr || ""}>
<option value="">Alle Jahre</option>
{years.map((y) => (
<option key={y} value={y.toString()}>{y}</option>
))}
</select>
</label>
<button type="submit">Suchen</button>
</div>
</form>