From dbd4cf59d2064240646ff9a01933e31c55a3e742 Mon Sep 17 00:00:00 2001 From: Dorian Date: Mon, 9 Mar 2026 21:27:26 +0000 Subject: [PATCH] fix: skip JSON body parsing for filebrowser upload routes express.json() middleware was consuming the binary file body before the upload handler could drain it, causing 404/parse errors on file uploads. Co-Authored-By: Claude Opus 4.6 --- neode-ui/mock-backend.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/neode-ui/mock-backend.js b/neode-ui/mock-backend.js index 08e0eb8c..7a58d883 100755 --- a/neode-ui/mock-backend.js +++ b/neode-ui/mock-backend.js @@ -40,7 +40,13 @@ const corsOptions = { } app.use(cors(corsOptions)) -app.use(express.json({ limit: '50mb' })) +// Skip JSON body parsing for filebrowser upload routes (binary file bodies) +app.use((req, res, next) => { + if (req.path.startsWith('/app/filebrowser/api/resources') && req.method === 'POST') { + return next() + } + express.json({ limit: '50mb' })(req, res, next) +}) app.use(cookieParser()) // Mock session storage