From e2fbd1dc95f755e086ee86bc6fe9b598728d5c5e Mon Sep 17 00:00:00 2001 From: David Kale Date: Tue, 14 Apr 2020 14:36:39 -0400 Subject: [PATCH] ArgumentNullException: Value cannot be null, for anonymous volume mounts (#426) * Dont check if path starts with null * Check SourceVolumePath not MountVolume obj * Prefer string.IsNullOrEmpty --- src/Runner.Worker/Handlers/StepHost.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Runner.Worker/Handlers/StepHost.cs b/src/Runner.Worker/Handlers/StepHost.cs index 08edc91a2..548a74f95 100644 --- a/src/Runner.Worker/Handlers/StepHost.cs +++ b/src/Runner.Worker/Handlers/StepHost.cs @@ -110,9 +110,9 @@ namespace GitHub.Runner.Worker.Handlers // try to resolve path inside container if the request path is part of the mount volume #if OS_WINDOWS - if (Container.MountVolumes.Exists(x => path.StartsWith(x.SourceVolumePath, StringComparison.OrdinalIgnoreCase))) + if (Container.MountVolumes.Exists(x => !string.IsNullOrEmpty(x.SourceVolumePath) && path.StartsWith(x.SourceVolumePath, StringComparison.OrdinalIgnoreCase))) #else - if (Container.MountVolumes.Exists(x => path.StartsWith(x.SourceVolumePath))) + if (Container.MountVolumes.Exists(x => !string.IsNullOrEmpty(x.SourceVolumePath) && path.StartsWith(x.SourceVolumePath))) #endif { return Container.TranslateToContainerPath(path);