[ZEPPELIN-6495] Use URLSearchParams in terminal getParams helper#5294
Open
kimyenac wants to merge 1 commit into
Open
[ZEPPELIN-6495] Use URLSearchParams in terminal getParams helper#5294kimyenac wants to merge 1 commit into
kimyenac wants to merge 1 commit into
Conversation
Replace the hand-rolled location.search.substr(1).match(...) parser and the deprecated unescape(...) call in the %sh.terminal frontend helper with the standard URLSearchParams API. URLSearchParams.get(key) returns null for missing keys, preserving the existing behavior for the noteId/paragraphId parameters consumed by the terminal page, while relying on standard URL decoding instead of the deprecated global unescape. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ParkGyeongTae
approved these changes
Jul 13, 2026
ParkGyeongTae
left a comment
Member
There was a problem hiding this comment.
LGTM. The replacement is correct and the behavior is preserved for all real inputs:
URLSearchParams.get()returnsnullfor missing keys, matching the previous fallbacknoteId/paragraphIdvalues are server-generated alphanumeric IDs, so theunescape()→URLSearchParamsdecoding difference has no practical effect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR for?
The
%sh.terminalfrontend helpergetParams(key)inshell/src/main/resources/html/js/index.jsparsed the query string by hand: it built aRegExpoverlocation.search, sliced it withsubstr(1), and decoded matches with the deprecated globalunescape(...). This is harder to read than the platform API and can diverge from standard URL parsing for encoded/repeated/special characters.This PR replaces that logic with the standard
URLSearchParamsAPI.URLSearchParams.get(key)returnsnullfor missing keys, so the existing behavior for thenoteId/paragraphIdparameters consumed by the terminal page is preserved, while relying on standard URL decoding instead of the deprecatedunescape.The
noteId/paragraphId/tvalues the server generates (seeTerminalInterpreter#createTerminalDashboard) are plain alphanumeric IDs and a numeric timestamp, so decoded values are identical to the previous implementation for all real inputs.What type of PR is it?
Refactoring
Todos
substr(...)/unescape(...)ingetParamswithURLSearchParamsWhat is the Jira issue?
How should this be tested?
index.js); theshellmodule has no JavaScript test harness (nopackage.json, and the existingTerminalInterpreterTestcovers the Java interpreter, not this script), so no automated JS test is added.%2F) → decoded (/)nullkey=) →""%sh.terminalparagraph so the terminal dashboard loads...?noteId=<id>¶graphId=<id>&t=<ts>, and confirm the terminal connects andTERMINAL_READYcarries the correctnoteId/paragraphId.Screenshots (if appropriate)
N/A
Questions: