fix(api): 🐛 Prevent non-images uploaded from not being saved to object storage

This commit is contained in:
Jesse Wierzbinski 2024-06-05 15:40:37 -10:00
parent 268ced27ef
commit f4af0e2407
No known key found for this signature in database
2 changed files with 3 additions and 5 deletions

View file

@ -39,7 +39,7 @@ export const attachmentToAPI = (
? `${attachment.width}x${attachment.height}` ? `${attachment.width}x${attachment.height}`
: undefined, : undefined,
duration: attachment.duration || undefined, duration: attachment.duration || undefined,
length: attachment.size?.toString() || undefined, length: undefined,
aspect: aspect:
attachment.width && attachment.height attachment.width && attachment.height
? attachment.width / attachment.height ? attachment.width / attachment.height

View file

@ -112,11 +112,9 @@ export default (app: Hono) =>
throw new Error("Invalid media backend"); throw new Error("Invalid media backend");
} }
if (isImage) { const { path } = await mediaManager.addFile(file);
const { path } = await mediaManager.addFile(file);
url = getUrl(path, config); url = getUrl(path, config);
}
let thumbnailUrl = ""; let thumbnailUrl = "";