MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / decodeRefSegments

Function decodeRefSegments

packages/agent-core/src/plugin/source.ts:102–112  ·  view source on GitHub ↗

* Join path segments and percent-decode them into a single ref name. * * `URL.pathname` keeps `%xx` sequences as-is (e.g. `release%231`), but * downstream code treats the ref value as a raw Git ref. Decoding here keeps * one canonical representation: human-readable in storage and display, and *

(segments: readonly string[])

Source from the content-addressed store, hash-verified

100 * so the user sees a meaningful error downstream rather than a parse crash.
101 */
102function decodeRefSegments(segments: readonly string[]): string {
103 return segments
104 .map((segment) => {
105 try {
106 return decodeURIComponent(segment);
107 } catch {
108 return segment;
109 }
110 })
111 .join('/');
112}

Callers 1

parseGithubUrlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected