Scan aus der Dateienseite starten

This commit is contained in:
2026-06-02 16:23:27 +02:00
parent c854b0bf30
commit 0ea4efdc43
3 changed files with 328 additions and 2 deletions

View File

@@ -44,6 +44,20 @@ const pickFileTargets = (target: unknown) => {
)
}
const readFileFolder = (target: unknown) => {
if (!target || typeof target !== "object" || Array.isArray(target)) return null
const folder = (target as Record<string, any>).folder
return typeof folder === "string" && folder.trim() ? folder.trim() : null
}
const readFileType = (target: unknown) => {
if (!target || typeof target !== "object" || Array.isArray(target)) return null
const type = (target as Record<string, any>).type
return typeof type === "string" && type.trim() ? type.trim() : null
}
export default async function instanceAgentGatewayRoutes(server: FastifyInstance) {
await server.register(multipart, {
limits: { fileSize: 100 * 1024 * 1024 },
@@ -206,8 +220,8 @@ export default async function instanceAgentGatewayRoutes(server: FastifyInstance
content: fileBuffer,
contentType: data.mimetype || "application/pdf",
},
null,
null,
readFileFolder(job.target),
readFileType(job.target),
{
...pickFileTargets(job.target),
createdBy: job.requestedBy,