Skip to content

Commit e413a58

Browse files
committed
fix error message when we try to read tree instead of blob object
1 parent 8b95c42 commit e413a58

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

GitContentSearch/GitHelper.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ public bool FileExistsAtCommit(string commitHash, string filePath, CancellationT
309309

310310
var tree = commit.Tree;
311311
var treeEntry = tree[filePath];
312-
return treeEntry != null;
312+
313+
// Return false if the path is a directory (Tree) or doesn't exist
314+
return treeEntry != null && treeEntry.TargetType == TreeEntryTargetType.Blob;
313315
}
314316
catch
315317
{

0 commit comments

Comments
 (0)