fix: Update filename in attachment creator

This commit is contained in:
Tom Moor
2024-02-05 22:56:04 -05:00
parent d4d226e011
commit c9e4a57ee3

View File

@@ -1,6 +1,7 @@
import { addHours } from "date-fns";
import { AttachmentPreset } from "@shared/types";
import env from "@server/env";
import { ValidateKey } from "@server/validation";
export enum Buckets {
public = "public",
@@ -30,7 +31,7 @@ export default class AttachmentHelper {
}) {
const bucket = acl === "public-read" ? Buckets.public : Buckets.uploads;
const keyPrefix = `${bucket}/${userId}/${id}`;
return `${keyPrefix}/${name}`;
return `${keyPrefix}/${ValidateKey.sanitize(name)}`;
}
/**