diff --git a/functions/api/reports/submit.ts b/functions/api/reports/submit.ts index abb5c3d..88194c7 100644 --- a/functions/api/reports/submit.ts +++ b/functions/api/reports/submit.ts @@ -145,8 +145,7 @@ export async function onRequestPost(context: RequestContext) { const fileParts = file.name.split("."); let fileExten = fileParts.at(-1); - if (fileExten.toLowerCase() === "mov") - fileExten = "mp4" + if (fileExten.toLowerCase() === "mov") fileExten = "mp4"; if ( fileParts.length < 2 || @@ -211,15 +210,15 @@ export async function onRequestPost(context: RequestContext) { for (const urlResult of uploadUrlResults as PromiseFulfilledResult[]) { uploadUrls.push(urlResult.value); - let url = urlResult.value.replace("t/", ""); + let url = new URL(urlResult.value).searchParams.get("name") as string; const extension = (url.split(".").at(-1) as string).toLowerCase(); if (["mkv", "wmv"].includes(extension)) { - await context.env.DATA.put(`videoprocessing_${url.replace(`.${extension}`, ".mp4")}`, "1", { + url = url.replace(`.${extension}`, ".mp4"); + + await context.env.DATA.put(`videoprocessing_${url}`, "1", { expirationTtl: 600, }); - - url = url.replace(`.${extension}`, ".mp4"); } attachments.push(url);