Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -0,0 +1,52 @@
// P4 Files (AK-P4a) §11 — bulk-ZIP download resource route (action only). The
// browser POSTs a set of fileIds; we stream back a zip of the files that are
// visible to the user AND scan-clean (fail-closed, AD-23 — infected/invisible
// files are silently dropped, never leaked). Gated: auth -> module -> files.read_own.
import type { ActionFunctionArgs } from "react-router";
import { zipSync } from "fflate";
import { badRequestResponse, fileActionErrorResponse, loadFilesContext, requireFilesPermission } from "~/utils/integrations/fileAccess.server";
import { collectFilesForZip } from "~/utils/integrations/fileService.server";
export const action = async ({ request, params }: ActionFunctionArgs) => {
try {
if (request.method !== "POST") {
return new Response("Method Not Allowed", { status: 405 });
}
const ctx = requireFilesPermission(await loadFilesContext({ request, params, requireModule: true }), "files.read_own");
const formData = await request.formData();
const fileIds = formData
.getAll("fileIds")
.map((value) => String(value))
.filter(Boolean);
if (fileIds.length === 0) {
return badRequestResponse();
}
const { entries } = await collectFilesForZip({ tenantId: ctx.tenantId, ctx, fileIds });
if (entries.length === 0) {
// Nothing buildable (all invisible / infected / over the cap).
return badRequestResponse();
}
const zipInput: Record<string, Uint8Array> = {};
for (const entry of entries) {
zipInput[entry.name] = entry.bytes;
}
const zipped = zipSync(zipInput);
// Hand the Response a plain ArrayBuffer (a typed BodyInit) — the fflate
// Uint8Array<ArrayBufferLike> is accepted at runtime but not by the type.
const body = zipped.buffer.slice(zipped.byteOffset, zipped.byteOffset + zipped.byteLength) as ArrayBuffer;
return new Response(body, {
status: 200,
headers: {
"content-type": "application/zip",
"content-disposition": 'attachment; filename="dateien.zip"',
"content-length": String(zipped.byteLength),
},
});
} catch (error) {
return fileActionErrorResponse(error);
}
};