Issue #2008540: Rework the apis path again so it finds the first branch with an exact then inexact match