Skip to content
/ qp-n8n Public
forked from n8n-io/n8n

Commit

Permalink
fix(core): Allow serving icons for custom nodes with npm scoped names (
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy authored and sunilrr committed Apr 24, 2023
1 parent 4adf70f commit 258b3a1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1293,8 +1293,9 @@ class Server extends AbstractServer {
},
};

this.app.use('/icons/:packageName/*/*.(svg|png)', async (req, res) => {
const { packageName } = req.params;
const serveIcons: express.RequestHandler = async (req, res) => {
let { scope, packageName } = req.params;
if (scope) packageName = `@${scope}/${packageName}`;
const loader = this.loadNodesAndCredentials.loaders[packageName];
if (loader) {
const pathPrefix = `/icons/${packageName}/`;
Expand All @@ -1309,7 +1310,10 @@ class Server extends AbstractServer {
}

res.sendStatus(404);
});
};

this.app.use('/icons/@:scope/:packageName/*/*.(svg|png)', serveIcons);
this.app.use('/icons/:packageName/*/*.(svg|png)', serveIcons);

this.app.use(
'/',
Expand Down

0 comments on commit 258b3a1

Please sign in to comment.