fix(upload): increase attachment size limit to 50mb (#144)

* fix(upload): increase attachment size limit to 50mb

Raises body limits in web proxy and desktop app. Adds client-side size checks and better 413 error handling.

* fix(client): auto-compress large images to avoid server body limits

Adds client-side compression for images >1MB. Resizes to max 2048px and converts large PNGs to JPEG. Adds detailed logging for debugging.

* chore: remove debug logs from client and proxy
This commit is contained in:
Bohdan Triapitsyn
2026-01-14 13:23:17 +02:00
committed by GitHub
parent 5ffec2acba
commit c4fb9d5730
5 changed files with 83 additions and 7 deletions
+3 -3
View File
@@ -17,7 +17,7 @@ interface FileActions {
type FileStore = FileState & FileActions;
const MAX_ATTACHMENT_SIZE = 10 * 1024 * 1024;
const MAX_ATTACHMENT_SIZE = 50 * 1024 * 1024;
const guessMimeTypeFromName = (filename: string): string => {
const name = (filename || "").toLowerCase();
@@ -135,7 +135,7 @@ export const useFileStore = create<FileStore>()(
const maxSize = MAX_ATTACHMENT_SIZE;
if (file.size > maxSize) {
throw new Error(`File "${file.name}" is too large. Maximum size is 10MB.`);
throw new Error(`File "${file.name}" is too large. Maximum size is 50MB.`);
}
const allowedTypes = [
@@ -251,7 +251,7 @@ export const useFileStore = create<FileStore>()(
: new TextEncoder().encode(fileContent || "").length;
if (sizeBytes > MAX_ATTACHMENT_SIZE) {
throw new Error(`File "${name}" is too large. Maximum size is 10MB.`);
throw new Error(`File "${name}" is too large. Maximum size is 50MB.`);
}
const file = new File([], name, { type: safeMimeType });