Sitesmith modal: load assets once; clearer oversize-image message
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
304850fcd3
commit
cfa8ab2e40
3 files changed
+5
-2
No files matched your search
@@ -26,7 +26,7 @@ export function formatBytes(n: number): string {
|
||||
export async function validateAttachment(file: File, maxBytes = DEFAULT_MAX_UPLOAD_BYTES): Promise<string | null> {
|
||||
const label = file.name ? `"${file.name.slice(0, 60)}"` : 'That file';
|
||||
if (file.size === 0) return `${label} is empty.`;
|
||||
if (file.size > maxBytes) return `${label} is ${formatBytes(file.size)}; the limit is ${formatBytes(maxBytes)}. Use a smaller image.`;
|
||||
if (file.size > maxBytes) return `${label} is ${formatBytes(file.size)}, which is over the ${formatBytes(maxBytes)} limit. Use a smaller image.`;
|
||||
const t = await sniffImageType(file);
|
||||
if (!t) return `${label} is not a JPEG, PNG, WebP or GIF image (SVG, PDF and other formats are not accepted).`;
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user