Skip to content

Commit c126b52

Browse files
author
David Kale
authored
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
1 parent 117ec1f commit c126b52

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Runner.Worker/Handlers/StepHost.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ public string ResolvePathForStepHost(string path)
110110

111111
// try to resolve path inside container if the request path is part of the mount volume
112112
#if OS_WINDOWS
113-
if (Container.MountVolumes.Exists(x => path.StartsWith(x.SourceVolumePath, StringComparison.OrdinalIgnoreCase)))
113+
if (Container.MountVolumes.Exists(x => !string.IsNullOrEmpty(x.SourceVolumePath) && path.StartsWith(x.SourceVolumePath, StringComparison.OrdinalIgnoreCase)))
114114
#else
115-
if (Container.MountVolumes.Exists(x => path.StartsWith(x.SourceVolumePath)))
115+
if (Container.MountVolumes.Exists(x => !string.IsNullOrEmpty(x.SourceVolumePath) && path.StartsWith(x.SourceVolumePath)))
116116
#endif
117117
{
118118
return Container.TranslateToContainerPath(path);

0 commit comments

Comments
 (0)