From 5cf7353cead572e783ea4598aed91b657ceb53f0 Mon Sep 17 00:00:00 2001 From: Kirill Osenkov Date: Tue, 28 May 2024 18:15:55 -0700 Subject: [PATCH] Normalize directory separators in target path --- src/Agent.Worker/Handlers/NodeHandler.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Agent.Worker/Handlers/NodeHandler.cs b/src/Agent.Worker/Handlers/NodeHandler.cs index fafe462f85..d3433c0e5a 100644 --- a/src/Agent.Worker/Handlers/NodeHandler.cs +++ b/src/Agent.Worker/Handlers/NodeHandler.cs @@ -129,6 +129,10 @@ public async Task RunAsync() string target = Data.Target; ArgUtil.NotNullOrEmpty(target, nameof(target)); target = Path.Combine(TaskDirectory, target); + + // Ensure the slashes are normalized, it's possible that the subpath inside the task is using / + // and the TaskDirectory is using \ on Windows. + target = Path.GetFullPath(target); ArgUtil.File(target, nameof(target)); // Resolve the working directory.