Skip to content

Commit 666e197

Browse files
committed
fixes attestation parsing in witness-verify
Addresses an issue where the attestation parsing in `witness-verify` would fail when the attestation file was empty or contained invalid JSON. Now, it handles empty files gracefully and catches parsing errors.
1 parent dcf451a commit 666e197

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ witness-verify:
114114
echo ""; \
115115
if [ -f conda-build.attestation.json ] && [ -s conda-build.attestation.json ]; then \
116116
echo "Attestation summary:"; \
117-
python -c "import json, sys; try: data = json.load(sys.stdin); print(f' Type: {data.get(\"type\", \"unknown\")}') except: print(' Type: unable to parse attestation')" < conda-build.attestation.json; \
117+
python -c "import json, sys; content = sys.stdin.read(); data = json.loads(content) if content else {}; print(f\" Type: {data.get('type', 'unknown')}\")" < conda-build.attestation.json 2>/dev/null || echo " Type: unable to parse attestation"; \
118118
elif [ -f conda-build.attestation.json ]; then \
119119
echo "Warning: Attestation file exists but is empty"; \
120120
else \

0 commit comments

Comments
 (0)