Check input path before getting relative path to execRoot.
@@ -262,9 +262,15 @@ public class SpawnLogContext implements ActionContext {
if (dirent.getType() == Dirent.Type.DIRECTORY) {
listDirectoryContents(child, addFile, metadataProvider);
} else {
+ String pathString;
+ if (child.startsWith(execRoot)) {
+ pathString = child.relativeTo(execRoot).toString();
+ } else {
+ pathString = child.toString();
+ }
addFile.accept(
File.newBuilder()
- .setPath(child.relativeTo(execRoot).toString())
+ .setPath(pathString)
.setDigest(computeDigest(null, child, metadataProvider, xattrProvider))
.build());
}
