fix(skills): widen BOM-tolerant reads to all comfyui workflow-JSON call paths
The salvaged fix covered run_workflow.py and hardware_check.py. The same locale-default read of user-authored workflow JSON exists in five sibling scripts (auto_fix_deps, check_deps, extract_schema, health_check, run_batch) — same bug class, same utf-8-sig fix. Invariant test extended to pin all nine read sites. The pdf half of the original PR is superseded: those scripts were replaced wholesale by the clean-room rewrite (#81890), which ships UTF-8-explicit I/O enforced by its own invariant test.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
CrazyWillBear
|
||||
@@ -102,7 +102,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
emit_json({"error": f"Workflow not found: {args.workflow}"})
|
||||
return 1
|
||||
try:
|
||||
with wf_path.open() as f:
|
||||
with wf_path.open(encoding="utf-8-sig") as f:
|
||||
workflow = unwrap_workflow(json.load(f))
|
||||
except (ValueError, json.JSONDecodeError) as e:
|
||||
emit_json({"error": str(e)})
|
||||
|
||||
@@ -408,7 +408,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
emit_json({"error": f"Workflow file not found: {args.workflow}"})
|
||||
return 1
|
||||
try:
|
||||
with wf_path.open() as f:
|
||||
with wf_path.open(encoding="utf-8-sig") as f:
|
||||
payload = json.load(f)
|
||||
workflow = unwrap_workflow(payload)
|
||||
except ValueError as e:
|
||||
|
||||
@@ -285,7 +285,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
return 1
|
||||
|
||||
try:
|
||||
with wf_path.open() as f:
|
||||
with wf_path.open(encoding="utf-8-sig") as f:
|
||||
payload = json.load(f)
|
||||
workflow = unwrap_workflow(payload)
|
||||
except ValueError as e:
|
||||
|
||||
@@ -163,7 +163,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
workflow_check = {"error": "workflow file not found"}
|
||||
else:
|
||||
try:
|
||||
with wf_path.open() as f:
|
||||
with wf_path.open(encoding="utf-8-sig") as f:
|
||||
workflow = unwrap_workflow(json.load(f))
|
||||
from check_deps import check_deps
|
||||
workflow_check = check_deps(workflow, host=args.host, api_key=api_key)
|
||||
|
||||
@@ -157,7 +157,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
emit_json({"error": f"Workflow not found: {args.workflow}"})
|
||||
return 1
|
||||
try:
|
||||
with wf_path.open() as f:
|
||||
with wf_path.open(encoding="utf-8-sig") as f:
|
||||
workflow = unwrap_workflow(json.load(f))
|
||||
except (ValueError, json.JSONDecodeError) as e:
|
||||
emit_json({"error": str(e)})
|
||||
|
||||
@@ -28,6 +28,13 @@ _ENCODING_SENSITIVE_READS = [
|
||||
("hardware_check.py", 'with open("/proc/meminfo", "r", encoding="utf-8") as fh:'),
|
||||
("run_workflow.py", 'with open(schema_path, encoding="utf-8-sig") as f:'),
|
||||
("run_workflow.py", 'with wf_path.open(encoding="utf-8-sig") as f:'),
|
||||
# Sibling call paths: every other script that parses a user-authored
|
||||
# workflow JSON reads it the same BOM-tolerant way (same bug class).
|
||||
("auto_fix_deps.py", 'wf_path.open(encoding="utf-8-sig")'),
|
||||
("check_deps.py", 'wf_path.open(encoding="utf-8-sig")'),
|
||||
("extract_schema.py", 'wf_path.open(encoding="utf-8-sig")'),
|
||||
("health_check.py", 'wf_path.open(encoding="utf-8-sig")'),
|
||||
("run_batch.py", 'wf_path.open(encoding="utf-8-sig")'),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user