Skip to content

Commit

Permalink
Check input path before getting relative path to execRoot.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 505072444
Change-Id: I551853ff081b9bef47f70f541b5d2afda60ef9b4
  • Loading branch information
coeuvre authored and copybara-github committed Jan 27, 2023
1 parent 09816bf commit c99e97a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,15 @@ private void listDirectoryContents(
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());
}
Expand Down

0 comments on commit c99e97a

Please sign in to comment.