node-red icon indicating copy to clipboard operation
node-red copied to clipboard

Can not display node icon when npm package has scope.

Open code2nguyen opened this issue 9 years ago • 2 comments

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

  1. 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);
  1. 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;

code2nguyen avatar Jun 30 '17 16:06 code2nguyen

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.

knolleary avatar Jun 30 '17 16:06 knolleary

Closed by #1307

knolleary avatar Jun 30 '17 20:06 knolleary