From 65a97271eab27e9d447530fd78cdf6494102facc Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Thu, 2 Apr 2026 22:16:48 +0300 Subject: [PATCH] Fix server error when uploading art with dots in the filename --- app/features/art/actions/art.new.server.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/features/art/actions/art.new.server.ts b/app/features/art/actions/art.new.server.ts index b74b679cf..ae9149a71 100644 --- a/app/features/art/actions/art.new.server.ts +++ b/app/features/art/actions/art.new.server.ts @@ -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(