Skip to content

Commit

Permalink
Another try at path matching.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed May 19, 2017
1 parent 5f4aa12 commit 5d73566
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/zope/app/apidoc/utilities.py
Expand Up @@ -53,7 +53,7 @@ def relativizePath(path):
return path
longest_matching_path = max(matching_paths, key=len)
common_prefix = os.path.commonprefix([longest_matching_path, path])
return path.replace(common_prefix, 'Zope3')
return path.replace(common_prefix, 'Zope3') if common_prefix else path

def truncateSysPath(path):
"""Remove the system path prefix from the path."""
Expand All @@ -62,7 +62,7 @@ def truncateSysPath(path):
return path
longest_matching_path = max(matching_paths, key=len)
common_prefix = os.path.commonprefix([longest_matching_path, path])
return path.replace(common_prefix, '')[1:]
return path.replace(common_prefix, '')[1:] if common_prefix else path

@implementer(IReadContainer)
class ReadContainerBase(object):
Expand Down

0 comments on commit 5d73566

Please sign in to comment.