replice filename space to _

This commit is contained in:
Nastya 2024-08-28 03:18:19 +03:00
parent 2610680b97
commit 90a967a8e6

@ -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({