Slightly unbreak file processing
This commit is contained in:
parent
7f39f0d89f
commit
788e14e971
@ -145,8 +145,7 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
const fileParts = file.name.split(".");
|
const fileParts = file.name.split(".");
|
||||||
let fileExten = fileParts.at(-1);
|
let fileExten = fileParts.at(-1);
|
||||||
|
|
||||||
if (fileExten.toLowerCase() === "mov")
|
if (fileExten.toLowerCase() === "mov") fileExten = "mp4";
|
||||||
fileExten = "mp4"
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
fileParts.length < 2 ||
|
fileParts.length < 2 ||
|
||||||
@ -211,15 +210,15 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
for (const urlResult of uploadUrlResults as PromiseFulfilledResult<string>[]) {
|
for (const urlResult of uploadUrlResults as PromiseFulfilledResult<string>[]) {
|
||||||
uploadUrls.push(urlResult.value);
|
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();
|
const extension = (url.split(".").at(-1) as string).toLowerCase();
|
||||||
|
|
||||||
if (["mkv", "wmv"].includes(extension)) {
|
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,
|
expirationTtl: 600,
|
||||||
});
|
});
|
||||||
|
|
||||||
url = url.replace(`.${extension}`, ".mp4");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
attachments.push(url);
|
attachments.push(url);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user