diff --git a/src/zope/app/apidoc/utilities.py b/src/zope/app/apidoc/utilities.py index 185e3987..1b353f24 100644 --- a/src/zope/app/apidoc/utilities.py +++ b/src/zope/app/apidoc/utilities.py @@ -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.""" @@ -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):