return full image path on upload

This commit is contained in:
2026-01-12 19:29:41 +13:00
parent 6bde837330
commit cf5801689f

View File

@@ -29,7 +29,7 @@ export async function POST({ request }: APIContext) {
const buffer = Buffer.from(await file.arrayBuffer()); const buffer = Buffer.from(await file.arrayBuffer());
await fs.writeFile(filepath, buffer); await fs.writeFile(filepath, buffer);
return httpResponse({ filename, success: true }, 201); return httpResponse({ url: `/api/image/${filename}`}, 201);
} catch (error) { } catch (error) {
return httpResponse({ error: `Failed to upload image, ${error}` }, 500); return httpResponse({ error: `Failed to upload image, ${error}` }, 500);