From 90a967a8e605b52aea5a8d47e22fd3d51ac3066e Mon Sep 17 00:00:00 2001 From: Nastya Date: Wed, 28 Aug 2024 03:18:19 +0300 Subject: [PATCH] replice filename space to _ --- lib/api/quizRelase.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/api/quizRelase.ts b/lib/api/quizRelase.ts index 99fb4a9..5dbc126 100644 --- a/lib/api/quizRelase.ts +++ b/lib/api/quizRelase.ts @@ -189,15 +189,18 @@ export function sendFile({ questionId, body, qid }: SendFileParams) { if (body.preview) return; const formData = new FormData(); + const file = new File([body.file], body.file.name.replace(/\s/g, "_")); + const nameImage = body.name.replace(/\s/g, "_"); + const answers: Answer[] = [ { question_id: questionId, - content: "file:" + body.name, + content: "file:" + nameImage, }, ]; formData.append("answers", JSON.stringify(answers)); - formData.append(body.name, body.file); + formData.append(nameImage, file); formData.append("qid", qid); return publicationMakeRequest({