mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -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 serveIcons: express.RequestHandler = async (req, res) => {
|
||||||
const { packageName } = req.params;
|
let { scope, packageName } = req.params;
|
||||||
|
if (scope) packageName = `@${scope}/${packageName}`;
|
||||||
const loader = this.loadNodesAndCredentials.loaders[packageName];
|
const loader = this.loadNodesAndCredentials.loaders[packageName];
|
||||||
if (loader) {
|
if (loader) {
|
||||||
const pathPrefix = `/icons/${packageName}/`;
|
const pathPrefix = `/icons/${packageName}/`;
|
||||||
|
@ -1309,7 +1310,10 @@ class Server extends AbstractServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
res.sendStatus(404);
|
res.sendStatus(404);
|
||||||
});
|
};
|
||||||
|
|
||||||
|
this.app.use('/icons/@:scope/:packageName/*/*.(svg|png)', serveIcons);
|
||||||
|
this.app.use('/icons/:packageName/*/*.(svg|png)', serveIcons);
|
||||||
|
|
||||||
this.app.use(
|
this.app.use(
|
||||||
'/',
|
'/',
|
||||||
|
|
Loading…
Reference in a new issue