mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-10 21:26:08 -05:00
Fix server error when uploading art with dots in the filename
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user