load previous attachments, video support

This commit is contained in:
Michael Freno
2026-01-05 18:52:50 -05:00
parent 5222e82b9a
commit 61303969e8
3 changed files with 186 additions and 56 deletions

View File

@@ -23,7 +23,17 @@ export default async function AddImageToS3(
console.log("url: " + uploadURL, "key: " + key);
const ext = /^.+\.([^.]+)$/.exec(filename);
const contentType = ext ? `image/${ext[1]}` : "application/octet-stream";
let contentType = "application/octet-stream";
if (ext) {
const extension = ext[1].toLowerCase();
if (["mp4", "webm", "mov", "quicktime"].includes(extension)) {
contentType =
extension === "mov" ? "video/quicktime" : `video/${extension}`;
} else {
contentType = `image/${extension}`;
}
}
const uploadResponse = await fetch(uploadURL, {
method: "PUT",
@@ -37,7 +47,9 @@ export default async function AddImageToS3(
throw new Error("Failed to upload file to S3");
}
if (type === "blog") {
// Only create thumbnails for images
const isImage = contentType.startsWith("image/");
if (type === "blog" && isImage) {
try {
const thumbnail = await resizeImage(file, 200, 200, 0.8);