fix(api): 🐛 Fetch media content-type from data, instead of doing naive guesses

This commit is contained in:
Jesse Wierzbinski 2024-12-16 23:57:21 +01:00
parent 6f67881d96
commit 4fdb96930f
No known key found for this signature in database
8 changed files with 111 additions and 23 deletions

View file

@ -1,3 +1,4 @@
import { mimeLookup } from "@/content_types.ts";
import { randomString } from "@/math.ts";
import { setCookie } from "@hono/hono/cookie";
import { createRoute, z } from "@hono/zod-openapi";
@ -245,7 +246,12 @@ export default (plugin: PluginType): void => {
const user = await User.fromDataLocal({
email: doesEmailExist ? undefined : email,
username,
avatar: picture,
avatar: picture
? {
url: picture,
content_type: await mimeLookup(picture),
}
: undefined,
password: undefined,
});