From 036a5ec0831ceb0aabbda1fecaff0f65b85f1b73 Mon Sep 17 00:00:00 2001 From: mmabdalla <101379618+mmabdalla@users.noreply.github.com> Date: Mon, 29 Dec 2025 01:43:49 +0200 Subject: [PATCH] Fix: Use Express static middleware for assets, remove redundant handler --- manifest.yaml | 5 ----- server.js | 8 +------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/manifest.yaml b/manifest.yaml index d0cdcaa..d704b61 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -25,11 +25,6 @@ routes: method: GET handler: serveEditor - # Static assets route - - path: /assets/:filepath - method: GET - handler: serveAssets - # API routes for pages - path: /api/pages method: GET diff --git a/server.js b/server.js index 543c2c8..ad7d367 100644 --- a/server.js +++ b/server.js @@ -79,6 +79,7 @@ app.use('/api/pages', createPagesRouter()); app.get('/preview/:id', previewPage); // Serve static assets (Vite build outputs) +// Note: BOSA forwards /bp_wb/assets/* to this plugin, so Express receives /assets/* app.use('/assets', express.static(path.join(__dirname, 'dist', 'assets'))); async function serveEditor(req, res) { @@ -86,13 +87,6 @@ async function serveEditor(req, res) { res.sendFile(indexPath); } -async function serveAssets(req, res) { - // Extract filepath parameter (everything after /assets/) - const filepath = req.params.filepath || req.path.replace('/assets/', ''); - const assetPath = path.join(__dirname, 'dist', 'assets', filepath); - res.sendFile(assetPath); -} - async function previewPage(req, res) { try { const pageId = req.params.id;