From 20bc6a9a5c036caa479b50cd71ba8b48c01d79fd Mon Sep 17 00:00:00 2001 From: Ethan Chiu Date: Tue, 7 Jul 2020 12:57:59 -0400 Subject: [PATCH] Add file length check --- src/Runner.Worker/ActionManifestManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Runner.Worker/ActionManifestManager.cs b/src/Runner.Worker/ActionManifestManager.cs index 27fe0f043..d6b12019b 100644 --- a/src/Runner.Worker/ActionManifestManager.cs +++ b/src/Runner.Worker/ActionManifestManager.cs @@ -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 {