Skip to content

Commit

Permalink
[tree] Fix GetTreeFullPaths in case of protocol://
Browse files Browse the repository at this point in the history
GetTreeFullPaths assumed that the first occurrence of ":/" was
the separator between filename and tree name in strings such as
"file.root:/dir/tree". However, the separator is the _last_
occurrence of ":/" -- e.g. if the file is read via a remote
protocol, its name starts with "protocol://".

This logic is of course still broken in case the name of the tree
or the one of the directory that contains it contains ":/", we
do not support that case.

This fixes #10216.
  • Loading branch information
eguiraud committed Mar 23, 2022
1 parent 6ae602b commit 14a31aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tree/tree/src/InternalTreeUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ std::vector<std::string> GetTreeFullPaths(const TTree &tree)
return {tree.GetName()};
}
std::string fullPath = treeDir->GetPath(); // e.g. "file.root:/dir"
fullPath = fullPath.substr(fullPath.find(":/") + 1); // e.g. "/dir"
fullPath = fullPath.substr(fullPath.rfind(":/") + 1); // e.g. "/dir"
fullPath += "/";
fullPath += tree.GetName(); // e.g. "/dir/tree"
return {fullPath};
Expand Down

0 comments on commit 14a31aa

Please sign in to comment.