From e1dbba915d18ad22e3caed7c77d6341345f1e88e Mon Sep 17 00:00:00 2001 From: Angular2guy Date: Sun, 5 May 2024 11:48:56 +0200 Subject: [PATCH] fix: upload --- .../java/ch/xxx/aidoclibchat/usecase/mapping/ImageMapper.java | 2 +- .../src/angular/src/app/image-query/image-query.component.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/ch/xxx/aidoclibchat/usecase/mapping/ImageMapper.java b/backend/src/main/java/ch/xxx/aidoclibchat/usecase/mapping/ImageMapper.java index 3fd7f17..f23e6f8 100644 --- a/backend/src/main/java/ch/xxx/aidoclibchat/usecase/mapping/ImageMapper.java +++ b/backend/src/main/java/ch/xxx/aidoclibchat/usecase/mapping/ImageMapper.java @@ -35,7 +35,7 @@ public ImageQueryDto map(MultipartFile multipartFile, String query) { } catch (Exception e) { LOG.info("Mapping failed.", e); } - return null; + return imageDto; } private ImageType toImageType(String contentType) { diff --git a/frontend/src/angular/src/app/image-query/image-query.component.ts b/frontend/src/angular/src/app/image-query/image-query.component.ts index e2ba9e1..494bc07 100644 --- a/frontend/src/angular/src/app/image-query/image-query.component.ts +++ b/frontend/src/angular/src/app/image-query/image-query.component.ts @@ -55,7 +55,8 @@ export class ImageQueryComponent { if (!!this.imageForm.controls.file) { this.result = null; const formData = new FormData(); - formData.append('file', (this.imageForm.controls.file as unknown as Blob)); + const myFile = this.imageForm.controls.file.value; + formData.append('file', myFile as Blob, myFile?.name as string); formData.append('query', this.imageForm.controls.query.value as unknown as string); formData.append('type', (this.imageForm.controls.file.value as unknown as File)?.type); console.log(formData);