Skip to content

Use quotes around default GVFS.Hooks.exe configuration #1838

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

Merged
merged 1 commit into from
May 14, 2025
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
3 changes: 2 additions & 1 deletion GVFS/GVFS.Common/FileSystem/HooksInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ static HooksInstaller()
public static string MergeHooksData(string[] defaultHooksLines, string filename, string hookName)
{
IEnumerable<string> valuableHooksLines = defaultHooksLines.Where(line => !string.IsNullOrEmpty(line.Trim()));
string absolutePathToHooksExecutable = Path.Combine(ExecutingDirectory, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName);
/* Wrap in quotes to handle spaces in the path */
string absolutePathToHooksExecutable = $"\"{Path.Combine(ExecutingDirectory, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName)}\"";

if (valuableHooksLines.Contains(GVFSPlatform.Instance.Constants.GVFSHooksExecutableName, GVFSPlatform.Instance.Constants.PathComparer))
{
Expand Down
4 changes: 1 addition & 3 deletions GVFS/GVFS.UnitTests/CommandLine/HooksInstallerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ public class HooksInstallerTests
{
private const string Filename = "hooksfile";
private readonly string expectedAbsoluteGvfsHookPath =
Path.Combine(
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
GVFSPlatform.Instance.Constants.GVFSHooksExecutableName);
$"\"{Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), GVFSPlatform.Instance.Constants.GVFSHooksExecutableName)}\"";

[TestCase]
[Category(CategoryConstants.ExceptionExpected)]
Expand Down