Add fix for specifying current dir in collections_paths (#62478)

This commit is contained in:
Jordan Borean 2019-09-19 01:04:22 +10:00 committed by Matt Davis
parent 66e5427ffb
commit 2e1c6a7839
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- Fix issue where the collection loader tracebacks if ``collections_paths = ./`` is set in the config

View file

@ -519,7 +519,7 @@ def get_collection_name_from_path(path):
# strip off the common prefix (handle weird testing cases of nested collection roots, eg)
collection_remnant = n_path[len(coll_path):]
# commonprefix may include the trailing /, prepend to the remnant if necessary (eg trailing / on root)
if collection_remnant[0] != '/':
if collection_remnant and collection_remnant[0] != '/':
collection_remnant = '/' + collection_remnant
# the path lives under this collection root, see if it maps to a collection
found_collection = _N_COLLECTION_PATH_RE.search(collection_remnant)