Say could not read when the trust file is not an object whose projects maps paths to objects
This commit is contained in:
+4
-1
@@ -415,7 +415,10 @@ def trust(paths):
|
||||
except (OSError, ValueError) as failure:
|
||||
print(f"could not read {config}: {getattr(failure, 'strerror', failure)}", file=sys.stderr)
|
||||
return
|
||||
projects = data.setdefault("projects", {})
|
||||
projects = data.setdefault("projects", {}) if isinstance(data, dict) else None
|
||||
if not isinstance(projects, dict) or any(not isinstance(entry, dict) for entry in projects.values()):
|
||||
print(f"could not read {config}: not an object whose projects maps paths to objects", file=sys.stderr)
|
||||
return
|
||||
granted = [path for path in paths if not projects.get(path, {}).get("hasTrustDialogAccepted")]
|
||||
if not granted:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user