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

(cherry picked from commit 2e1c6a7839)
pull/62539/head
Jordan Borean 5 years ago committed by Toshio Kuratomi
parent b300cbf757
commit a3ff8e0579

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

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

Loading…
Cancel
Save