MCPcopy Index your code
hub / github.com/coder/mux / encodeParameterValue

Method encodeParameterValue

src/node/services/coderService.ts:805–811  ·  view source on GitHub ↗

* Encode a parameter string for the Coder CLI's --parameter flag. * The CLI uses CSV parsing, so values containing quotes or commas need escaping: * - Wrap the entire string in double quotes * - Escape internal double quotes as ""

(nameValue: string)

Source from the content-addressed store, hash-verified

803 * - Escape internal double quotes as ""
804 */
805 private encodeParameterValue(nameValue: string): string {
806 if (!nameValue.includes('"') && !nameValue.includes(",")) {
807 return nameValue;
808 }
809 // CSV quoting: wrap in quotes, escape internal quotes as ""
810 return `"${nameValue.replace(/"/g, '""')}"`;
811 }
812
813 /**
814 * Compute extra --parameter flags needed for workspace creation.

Callers 1

computeExtraParamsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected