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
+4 -3
View File
@@ -1851,6 +1851,7 @@ function setupProxy(app) {
},
onProxyReq: (proxyReq, req, res) => {
console.log(`Proxying ${req.method} ${req.path} to OpenCode`);
if (req.headers.accept && req.headers.accept.includes('text/event-stream')) {
console.log(`[SSE] Setting up SSE proxy for ${req.method} ${req.path}`);
proxyReq.setHeader('Accept', 'text/event-stream');
@@ -1997,16 +1998,16 @@ async function main(options = {}) {
req.path.startsWith('/api/opencode')
) {
express.json()(req, res, next);
express.json({ limit: '50mb' })(req, res, next);
} else if (req.path.startsWith('/api')) {
next();
} else {
express.json()(req, res, next);
express.json({ limit: '50mb' })(req, res, next);
}
});
app.use(express.urlencoded({ extended: true }));
app.use(express.urlencoded({ extended: true, limit: '50mb' }));
app.use((req, res, next) => {
console.log(`${new Date().toISOString()} - ${req.method} ${req.path}`);