Fix server error when uploading art with dots in the filename
Some checks are pending
E2E Tests / e2e (push) Waiting to run
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run

This commit is contained in:
Kalle
2026-04-02 22:16:48 +03:00
parent 8550cadead
commit 65a97271ea

View File

@@ -73,8 +73,11 @@ export const action: ActionFunction = async ({ request }) => {
fileUpload.fieldName === "img" ||
fileUpload.fieldName === "smallImg"
) {
const [, ending] = fileUpload.name.split(".");
invariant(ending);
const ending = fileUpload.name.split(".").pop();
invariant(
ending && ending !== fileUpload.name,
`File missing extension: "${fileUpload.name}"`,
);
const newFilename = `${preDecidedFilename}${fileUpload.fieldName === "smallImg" ? "-small" : ""}.${ending}`;
const uploadedFileLocation = await uploadStreamToS3(