Skip to content

fix: collapse multiline template literal in WebSocket URL construction#445

Open
DevLikhith5 wants to merge 1 commit into
neutralinojs:mainfrom
DevLikhith5:fix/websocket-url-whitespace-399
Open

fix: collapse multiline template literal in WebSocket URL construction#445
DevLikhith5 wants to merge 1 commit into
neutralinojs:mainfrom
DevLikhith5:fix/websocket-url-whitespace-399

Conversation

@DevLikhith5

Copy link
Copy Markdown

Closes #399.

The Bug

src/modules/websocket.js uses a multiline template literal to construct the WebSocket URL:

ws = new WS(\`ws://127.0.0.1:${authInfo.nlPort}?extensionId=js.neutralino.devtools
                &connectToken=${authInfo.nlConnectToken}\`);

The newline and leading spaces between extensionId and connectToken become part of the URL, so the parsed extensionId value contains "js.neutralino.devtools\n " instead of "js.neutralino.devtools".

The Fix

Collapse the template literal to a single line. No logic change.

Checklist

  • Conventional Commit (fix:)
  • CHANGELOG updated under UnreleasedBugfixes/improvements
  • No new dependencies added
  • No modern JS features used (stays compatible with Node.js 12+)

The multiline template literal in src/modules/websocket.js injects a
newline and spaces into the extensionId query parameter, causing the
parsed extensionId value to contain trailing whitespace.

Collapsing to a single line fixes the URL.

Closes neutralinojs#399
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebSocket URL contains whitespace in extensionId query parameter due to multiline template literal

1 participant