Add fix for specifying current dir in collections_paths (#62478)
This commit is contained in:
parent
66e5427ffb
commit
2e1c6a7839
2 changed files with 3 additions and 1 deletions
2
changelogs/fragments/collection-prefix-basedir.yaml
Normal file
2
changelogs/fragments/collection-prefix-basedir.yaml
Normal file
|
@ -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…
Reference in a new issue