Add file length check

This commit is contained in:
Ethan Chiu
2020-07-07 12:57:59 -04:00
parent 191a096f8d
commit 20bc6a9a5c

View File

@@ -63,7 +63,11 @@ namespace GitHub.Runner.Worker
// Instead of using Regex which can be computationally expensive,
// we can just remove the # of characters from the fileName according to the length of the basePath
string basePath = _hostContext.GetDirectory(WellKnownDirectory.Actions);
var fileName = manifestFile.Remove(0, basePath.Length + 1);
string fileName = manifestFile;
if (manifestFile.Length > basePath.Length + 1)
{
fileName = manifestFile.Remove(0, basePath.Length + 1);
}
try
{