fix: update Blob creation for file uploads to handle buffer offsets correctly

This commit is contained in:
Nils-Johan Gynther
2026-04-30 20:12:10 +02:00
parent 797241f262
commit 8910e6817d
3 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
import { Controller, Get } from '@nestjs/common';
import { Public } from '../auth/decorators/public.decorator';
import { AI_CATEGORIZATION_MODEL } from './ai.service';
import { RECEIPT_IMPORT_MODEL } from '../receipt-import/receipt-import.service';
const RECEIPT_IMPORT_MODEL = 'mistral-small-2603';
export interface AiModelInfo {
id: string;
@@ -53,7 +53,7 @@ export class QuickImportService {
const form = new FormData();
form.append(
'file',
new Blob([file.buffer], { type: file.mimetype }),
new Blob([file.buffer.buffer.slice(file.buffer.byteOffset, file.buffer.byteOffset + file.buffer.byteLength)], { type: file.mimetype }),
file.originalname,
);
@@ -40,7 +40,7 @@ export class ReceiptImportService {
const form = new FormData();
form.append(
'file',
new Blob([file.buffer], { type: file.mimetype }),
new Blob([file.buffer.buffer.slice(file.buffer.byteOffset, file.buffer.byteOffset + file.buffer.byteLength)], { type: file.mimetype }),
file.originalname,
);