From 98172764ac325d76ec2199922eda75677e1f3b3d Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 10 Jun 2021 14:15:43 +0100 Subject: [PATCH] Handle node icon paths for scoped modules Fixes #3013 --- .../@node-red/editor-client/src/js/ui/utils.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js index 9a8f0baa5..1718136fe 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js @@ -856,6 +856,7 @@ RED.utils = (function() { obj[key] = value; } } + function separateIconPath(icon) { var result = {module: "", file: ""}; if (icon) { @@ -863,10 +864,10 @@ RED.utils = (function() { if (index === 0) { icon = icon.substring((RED.settings.apiRootUrl+'icons/').length); } - index = icon.indexOf('/'); - if (index !== -1) { - result.module = icon.slice(0, index); - result.file = icon.slice(index + 1); + var match = /^((?:@[^/]+\/)?[^/]+)\/(.*)$/.exec(icon); + if (match) { + result.module = match[1]; + result.file = match[2]; } else { result.file = icon; }