-
-
Notifications
You must be signed in to change notification settings - Fork 21
fix: Properly escape file path in chmod command (#1527) #1732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,8 @@ public virtual async Task<CommandResult> InstallFromFileAsync(InstallerOptions o | |
| }, cancellationToken).ConfigureAwait(false); | ||
| } | ||
|
|
||
| await _bash.Command(new BashCommandOptions($"chmod u+x {options.Path}"), cancellationToken).ConfigureAwait(false); | ||
| var escapedPath = options.Path.Replace("'", "'\\''"); | ||
| await _bash.Command(new BashCommandOptions($"chmod u+x '{escapedPath}'"), cancellationToken).ConfigureAwait(false); | ||
|
Comment on lines
+31
to
+32
|
||
|
|
||
| return await _bash.FromFile(new BashFileOptions(options.Path), cancellationToken).ConfigureAwait(false); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The escaping logic is duplicated from the existing EscapeShellArgument utility method in PredefinedInstallers.cs (line 194). Consider extracting this method to a shared utility class to maintain consistency and follow the DRY principle. The existing method at PredefinedInstallers.cs:194-199 uses the same escaping pattern and includes documentation explaining the approach.