mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
fix(core): Allow serving icons for custom nodes with npm scoped names (#5626)
This commit is contained in:
committed by
GitHub
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(
|
||||||
'/',
|
'/',
|
||||||
|
|||||||
Reference in New Issue
Block a user