node-red
node-red copied to clipboard
Can not display node icon when npm package has scope.
I updated node-red 0.17.0 and found this error:
I have a node of node-red and my npm package uses scope.... node-red ui can not display the icon of my node.
Example : package.json
{
"name": "@my-scope/test-node",
"version": "1.0.0"
...
}
then Node-Red editor will try to get my icon with URL : http://localhost:8080/icons/@my-scope/test-node/my-icon.png
It returns a 404 (Not Found) error.
So, i must do some hotfixes
- In node-red/red/api/index.js :
editorApp.get("/icons/:module/:icon",ui.icon);
// Add new API with scope
editorApp.get("/icons/:scope/:module/:icon",ui.icon);
- In node-red/red/api/ui.js
// var module = req.params.module; OLD code
var scope = req.params.scope;
var module = scope ? scope + '/' + req.params.module : req.params.module;
Good spot, thanks. Want to stick a pull request in with your fix? Not going to rush a 0.17.1 for this, but good to get the fix in.
Closed by #1307