From c5c5d8e860553153b10109c3cd9ac27b3b59a52d Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 14 Jan 2025 15:08:31 +0100 Subject: [PATCH] linter spread fix --- front/lib/api/files/upsert.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/front/lib/api/files/upsert.ts b/front/lib/api/files/upsert.ts index 642e73ed6c62..142dd89222fa 100644 --- a/front/lib/api/files/upsert.ts +++ b/front/lib/api/files/upsert.ts @@ -213,6 +213,7 @@ const upsertDocumentToDatasource: ProcessingFunction = async ({ // Use the file id as the document id to make it easy to track the document back to the file. const sourceUrl = file.getPrivateUrl(auth); + const { title: upsertTitle, ...restArgs } = upsertArgs ?? {}; const upsertDocumentRes = await upsertDocument({ document_id: file.sId, source_url: sourceUrl, @@ -223,10 +224,10 @@ const upsertDocumentToDatasource: ProcessingFunction = async ({ dataSource, auth, mime_type: file.contentType, - title: file.fileName, + title: upsertTitle ?? file.fileName, // Used to override defaults. - ...(upsertArgs ?? {}), + ...restArgs, }); if (upsertDocumentRes.isErr()) { @@ -253,6 +254,7 @@ const upsertTableToDatasource: ProcessingFunction = async ({ if (upsertArgs && "tableId" in upsertArgs) { tableId = upsertArgs.tableId ?? tableId; } + const { title: upsertTitle, ...restArgs } = upsertArgs ?? {}; const upsertTableRes = await upsertTable({ tableId, name: slugify(file.fileName), @@ -265,11 +267,11 @@ const upsertTableToDatasource: ProcessingFunction = async ({ dataSource, auth, useAppForHeaderDetection: true, - title: file.fileName, + title: upsertTitle ?? file.fileName, mimeType: file.contentType, // Used to override defaults, for manual file uploads where some fields are user-defined. - ...(upsertArgs ?? {}), + ...restArgs, }); if (upsertTableRes.isErr()) {