Skip to content

Commit a83176a

Browse files
authored
Merge pull request desktop#21881 from desktop/improve-custom-shell-launch
Fix target path quotation when launching custom shells
2 parents cd1502d + 24bfa30 commit a83176a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

app/src/lib/custom-integration.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,14 @@ export function expandTargetPathArgument(
7070
args: ReadonlyArray<string>,
7171
repoPath: string
7272
): ReadonlyArray<string> {
73-
return args.map(arg => arg.replaceAll(TargetPathArgument, repoPath))
73+
return args.map(arg =>
74+
arg
75+
// If the placeholder is already quoted (e.g. "%TARGET_PATH%"), replace
76+
// it including the surrounding quotes to avoid double-quoting the path.
77+
.replaceAll(`"${TargetPathArgument}"`, `"${repoPath}"`)
78+
// For unquoted occurrences, wrap the path in quotes.
79+
.replaceAll(TargetPathArgument, `"${repoPath}"`)
80+
)
7481
}
7582

7683
/**

0 commit comments

Comments
 (0)