MCPcopy
hub / github.com/chartbrew/chartbrew / sanitizeSnippet

Function sanitizeSnippet

server/modules/updateAudit.js:117–131  ·  view source on GitHub ↗
(value, maxLength = DEFAULT_MAX_STRING_LENGTH)

Source from the content-addressed store, hash-verified

115}
116
117function sanitizeSnippet(value, maxLength = DEFAULT_MAX_STRING_LENGTH) {
118 if (value === undefined || value === null || value === "") {
119 return null;
120 }
121
122 if (typeof value === "string") {
123 return truncateString(redactScalar(collapseWhitespace(value)), maxLength);
124 }
125
126 try {
127 return truncateString(JSON.stringify(sanitizePayload(value)), maxLength);
128 } catch (error) {
129 return truncateString(String(value), maxLength);
130 }
131}
132
133function sanitizeHeaderNames(headers) {
134 if (!headers || typeof headers !== "object") {

Callers 4

runRequestMethod · 0.85
serializeResponsePreviewFunction · 0.85
sanitizeToolErrorFunction · 0.85
runDataRequestFunction · 0.85

Calls 4

truncateStringFunction · 0.85
redactScalarFunction · 0.85
collapseWhitespaceFunction · 0.85
sanitizePayloadFunction · 0.85

Tested by

no test coverage detected