mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(core): Allow serving icons for custom nodes with npm scoped names (#5626)
This commit is contained in:
parent
96142d78de
commit
45ccdd3bb5
|
@ -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}/`;
|
||||
|
@ -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(
|
||||
'/',
|
||||
|
|
Loading…
Reference in a new issue