mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
comments
This commit is contained in:
parent
0d4fd41cde
commit
3a2def77d0
@ -19,6 +19,7 @@ export async function parseBase64Image(input: string, options: {
|
||||
// Remove data URL prefix if present (e.g., "data:image/jpeg;base64,")
|
||||
const base64Data = input.replace(/^data:image\/[a-z]+;base64,/, '');
|
||||
|
||||
// check the size before and after the base64 conversion
|
||||
if (base64Data.length > options.maxBytes!) {
|
||||
throw new ImageProcessingError(`Image size (${base64Data.length} bytes) exceeds maximum allowed size (${options.maxBytes} bytes)`);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user