Skip to content

Commit

Permalink
fix: update sourceSandboxName and Id
Browse files Browse the repository at this point in the history
  • Loading branch information
soridalac committed Oct 14, 2024
1 parent 4c3ee45 commit 0c22746
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/shared/sandboxRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ export async function createSandboxRequest(
const sandboxDefFileContents = definitionFile ? readSandboxDefFile(definitionFile) : {};

const capitalizedVarArgs = properties ? lowerToUpper(properties) : {};
const isClone = sandboxDefFileContents.SourceSandboxName ?? sandboxDefFileContents.SourceId;

// varargs override file input
const sandboxReqWithName: SandboxRequest & { SourceSandboxName?: string; SourceId?: string } = {
...(sandboxDefFileContents as Record<string, unknown>),
Expand All @@ -90,12 +88,12 @@ export async function createSandboxRequest(
(sandboxDefFileContents.SandboxName as string) ??
(await generateSboxName()),
};

const isClone = sandboxReqWithName.SourceSandboxName ?? sandboxReqWithName.SourceId;
const { SourceSandboxName, SourceId, ...sandboxReq } = sandboxReqWithName;
logger.debug('SandboxRequest after merging DefFile and Varargs: %s ', sandboxReq);

if (isClone) {
if (!sandboxDefFileContents.SourceSandboxName && !sandboxDefFileContents.SourceId) {
if (!sandboxReqWithName.SourceSandboxName && !sandboxReqWithName.SourceId) {
// error - we need SourceSandboxName or SourceId to know which sandbox to clone from
throw new SfError(
cloneMessages.getMessage('missingSourceSandboxName', ['SourceSandboxName']),
Expand Down

0 comments on commit 0c22746

Please sign in to comment.