mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Prevent loading non-dict vars (#5107)
This commit is contained in:
@@ -355,6 +355,12 @@ class Context(CtxDict):
|
||||
loader = LOADERS[ext]
|
||||
|
||||
data = loader(path, tree=tree)
|
||||
if not isinstance(data, Mapping):
|
||||
typ = type(data).__name__
|
||||
raise ContextError(
|
||||
f"expected a dictionary, got '{typ}' in file '{file}'"
|
||||
)
|
||||
|
||||
select_keys = select_keys or []
|
||||
if select_keys:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user