Skip to content

Commit 9b8aa71

Browse files
committed
linter spread fix
1 parent 82dd5de commit 9b8aa71

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

front/lib/api/files/upsert.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ const upsertDocumentToDatasource: ProcessingFunction = async ({
213213
// Use the file id as the document id to make it easy to track the document back to the file.
214214
const sourceUrl = file.getPrivateUrl(auth);
215215
const documentId = upsertArgs?.document_id ?? file.sId; // Use the file sId as a fallback to make it easy to track the table back to the file.
216+
const { title: upsertTitle, ...restArgs } = upsertArgs ?? {};
216217
const upsertDocumentRes = await upsertDocument({
217218
document_id: documentId,
218219
source_url: sourceUrl,
@@ -223,10 +224,10 @@ const upsertDocumentToDatasource: ProcessingFunction = async ({
223224
dataSource,
224225
auth,
225226
mime_type: file.contentType,
226-
title: file.fileName,
227+
title: upsertTitle ?? file.fileName,
227228

228229
// Used to override defaults.
229-
...(upsertArgs ?? {}),
230+
...restArgs,
230231
});
231232

232233
if (upsertDocumentRes.isErr()) {
@@ -253,6 +254,7 @@ const upsertTableToDatasource: ProcessingFunction = async ({
253254
if (upsertArgs && "tableId" in upsertArgs) {
254255
tableId = upsertArgs.tableId ?? tableId;
255256
}
257+
const { title: upsertTitle, ...restArgs } = upsertArgs ?? {};
256258
const upsertTableRes = await upsertTable({
257259
tableId,
258260
name: slugify(file.fileName),
@@ -265,11 +267,11 @@ const upsertTableToDatasource: ProcessingFunction = async ({
265267
dataSource,
266268
auth,
267269
useAppForHeaderDetection: true,
268-
title: file.fileName,
270+
title: upsertTitle ?? file.fileName,
269271
mimeType: file.contentType,
270272

271273
// Used to override defaults, for manual file uploads where some fields are user-defined.
272-
...(upsertArgs ?? {}),
274+
...restArgs,
273275
});
274276

275277
if (upsertTableRes.isErr()) {

0 commit comments

Comments
 (0)