diff --git a/src/shared/previewUtils.ts b/src/shared/previewUtils.ts index f5de5279..4df13c2c 100644 --- a/src/shared/previewUtils.ts +++ b/src/shared/previewUtils.ts @@ -239,7 +239,7 @@ export class PreviewUtils { targetOrg?: string ): string[] { let appPath = `lwr/application/e/devpreview/ai/${encodeURIComponent( - 'localdev%2Fpreview' + 'localdev/preview' )}?ldpServerUrl=${ldpServerUrl}&ldpServerId=${ldpServerId}`; if (componentName) { // TODO: support other namespaces diff --git a/test/shared/previewUtils.test.ts b/test/shared/previewUtils.test.ts index 9063f1a8..a0050903 100644 --- a/test/shared/previewUtils.test.ts +++ b/test/shared/previewUtils.test.ts @@ -282,6 +282,25 @@ describe('previewUtils', () => { expect(parsed.values['target-org']).to.be.undefined; }); + it('generatedComponentPreviewLaunchArguments propertly encodes parameters', async () => { + const result = PreviewUtils.generateComponentPreviewLaunchArguments('https://localhost:3333', testLdpServerId); + + const parsed = parseArgs({ + args: result, + options: { + path: { type: 'string' }, + 'target-org': { type: 'string' }, + }, + }); + + for (const v in parsed.values) { + if (v.length === 0) { + continue; + } + expect(decodeURIComponent(v) === decodeURIComponent(decodeURIComponent(v))); + } + }); + it('getTargetOrgFromArguments finds -o flag', async () => { const args = ['command', '-o', 'myOrg', 'otherArg']; const result = PreviewUtils.getTargetOrgFromArguments(args);