Skip to content

Commit f1f49ba

Browse files
committed
Fix tests and improve server error debugging
1 parent 8fe2496 commit f1f49ba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ctfcli/core/challenge.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ def _get_initial_challenge_payload(self, ignore: Tuple[str] = ()) -> Dict:
292292
challenge_payload["connection_info"] = challenge.get("connection_info", None)
293293

294294
if "logic" not in ignore:
295-
challenge_payload["logic"] = challenge.get("logic", "any")
295+
if challenge.get("logic"):
296+
challenge_payload["logic"] = challenge.get("logic") or "any"
296297

297298
if "extra" not in ignore:
298299
challenge_payload = {**challenge_payload, **challenge.get("extra", {})}
@@ -691,6 +692,8 @@ def sync(self, ignore: Tuple[str] = ()) -> None:
691692

692693
# Update simple properties
693694
r = self.api.patch(f"/api/v1/challenges/{self.challenge_id}", json=challenge_payload)
695+
if r.ok is False:
696+
click.secho(f"Failed to sync challenge: ({r.status_code}) {r.text}", fg="red")
694697
r.raise_for_status()
695698

696699
# Update flags
@@ -815,6 +818,8 @@ def create(self, ignore: Tuple[str] = ()) -> None:
815818
challenge_payload[p] = ""
816819

817820
r = self.api.post("/api/v1/challenges", json=challenge_payload)
821+
if r.ok is False:
822+
click.secho(f"Failed to create challenge: ({r.status_code}) {r.text}", fg="red")
818823
r.raise_for_status()
819824

820825
self.challenge_id = r.json()["data"]["id"]

0 commit comments

Comments
 (0)