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
32 changes: 0 additions & 32 deletions src/server/lib/nativeHelm/__tests__/helm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,38 +483,6 @@ describe('Native Helm', () => {
expect(result).not.toContain('--version');
});

it('should preserve inner double quotes in --set keys for annotation paths', () => {
const result = constructHelmCommand(
'upgrade --install',
'my-chart',
'my-release',
'my-namespace',
['ingress.extraAnnotations."app\\.kubernetes\\.io/name"=my-app'],
[],
ChartType.PUBLIC,
undefined,
'https://example.com/charts'
);

expect(result).toContain('--set "ingress.extraAnnotations.\\"app\\.kubernetes\\.io/name\\"=my-app"');
});

it('should escape inner double quotes in --set values', () => {
const result = constructHelmCommand(
'upgrade --install',
'my-chart',
'my-release',
'my-namespace',
['deployment.env.MSG="hello world"'],
[],
ChartType.PUBLIC,
undefined,
'https://example.com/charts'
);

expect(result).toContain('--set "deployment.env.MSG=\\"hello world\\""');
});

it('should not add chart version for PUBLIC charts when version is not specified', () => {
const result = constructHelmCommand(
'upgrade --install',
Expand Down
6 changes: 3 additions & 3 deletions src/server/lib/nativeHelm/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ export function constructHelmCommand(
customValues.forEach((value) => {
const equalIndex = value.indexOf('=');
if (equalIndex > -1) {
const key = value.substring(0, equalIndex).replace(/"/g, '\\"');
const key = value.substring(0, equalIndex);
const val = value.substring(equalIndex + 1);
const escapedVal = escapeHelmValue(val).replace(/"/g, '\\"');
const escapedVal = escapeHelmValue(val);
command += ` --set "${key}=${escapedVal}"`;
} else {
command += ` --set "${value.replace(/"/g, '\\"')}"`;
command += ` --set "${value}"`;
}
});

Expand Down
Loading