From 346ccf44391f81baced6018ceee2fbc937cfb467 Mon Sep 17 00:00:00 2001 From: Tyrie Vella Date: Tue, 13 May 2025 12:19:56 -0700 Subject: [PATCH] Use quotes around default GVFS.Hooks.exe configuration --- GVFS/GVFS.Common/FileSystem/HooksInstaller.cs | 3 ++- GVFS/GVFS.UnitTests/CommandLine/HooksInstallerTests.cs | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/GVFS/GVFS.Common/FileSystem/HooksInstaller.cs b/GVFS/GVFS.Common/FileSystem/HooksInstaller.cs index 8480f83a00..76fc6d028b 100644 --- a/GVFS/GVFS.Common/FileSystem/HooksInstaller.cs +++ b/GVFS/GVFS.Common/FileSystem/HooksInstaller.cs @@ -28,7 +28,8 @@ static HooksInstaller() public static string MergeHooksData(string[] defaultHooksLines, string filename, string hookName) { IEnumerable 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)) { diff --git a/GVFS/GVFS.UnitTests/CommandLine/HooksInstallerTests.cs b/GVFS/GVFS.UnitTests/CommandLine/HooksInstallerTests.cs index bf40c040b5..a9a5fcbf9e 100644 --- a/GVFS/GVFS.UnitTests/CommandLine/HooksInstallerTests.cs +++ b/GVFS/GVFS.UnitTests/CommandLine/HooksInstallerTests.cs @@ -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)]