Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/diagnostic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ function redactNetworkRequest(req: unknown): unknown {
redacted.responseHeaders = redactHeaders(redacted.responseHeaders as Record<string, string>);
}

// Truncate response body
// Redact and truncate response body
if (typeof redacted.body === 'string') {
redacted.body = truncate(redacted.body, MAX_REQUEST_BODY_CHARS);
redacted.body = redactText(truncate(redacted.body, MAX_REQUEST_BODY_CHARS));
}
if ('responseBody' in redacted) {
redacted.responseBody = sanitizeCapturedValue(redacted.responseBody);
Expand Down
10 changes: 5 additions & 5 deletions src/generate-verified.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ function candidateToJs(candidate: CandidateYaml): string {
const browser = detectBrowserFlag(candidate);

const argsArray = Object.entries(candidate.args ?? {}).map(([name, def]) => {
const parts: string[] = [`name: '${name}'`];
if (def.type && def.type !== 'str') parts.push(`type: '${def.type}'`);
const parts: string[] = [`name: '${name.replace(/'/g, "\\'")}'`];
if (def.type && def.type !== 'str') parts.push(`type: '${def.type.replace(/'/g, "\\'")}'`);
if (def.required) parts.push('required: true');
if (def.default !== undefined) parts.push(`default: ${JSON.stringify(def.default)}`);
if (def.description) parts.push(`help: '${def.description.replace(/'/g, "\\'")}'`);
Expand Down Expand Up @@ -527,10 +527,10 @@ function candidateToJs(candidate: CandidateYaml): string {
lines.push("import { cli, Strategy } from '@jackwener/opencli/registry';");
lines.push('');
lines.push('cli({');
lines.push(` site: '${candidate.site}',`);
lines.push(` name: '${candidate.name}',`);
lines.push(` site: '${candidate.site.replace(/'/g, "\\'")}',`);
lines.push(` name: '${candidate.name.replace(/'/g, "\\'")}',`);
if (candidate.description) lines.push(` description: '${candidate.description.replace(/'/g, "\\'")}',`);
if (candidate.domain) lines.push(` domain: '${candidate.domain}',`);
if (candidate.domain) lines.push(` domain: '${candidate.domain.replace(/'/g, "\\'")}',`);
lines.push(` strategy: ${stratEnum},`);
lines.push(` browser: ${browser},`);
if (argsArray.length > 0) {
Expand Down
Loading