File key not respecting null keys
Opened this issue · 0 comments
Inside of most of the keys, it is optional to have values.
ctfcli/ctfcli/core/challenge.py
Line 583 in d8e08da
For files, it is not optional and fails if you have no files under your key. Removing the key fixes the issue but this should be either documented in the spec better or fixed (preferred I think). Might be as simple as a better check?
ctfcli/ctfcli/core/challenge.py
Line 589 in d8e08da
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.10/x64/bin/ctf", line 8, in
sys.exit(main())
^^^^^^
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ctfcli/main.py", line 136, in main
ret = fire.Fire(COMMANDS["cli"], serialize=lambda r: None if isinstance(r, int) else r)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/fire/core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/fire/core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ctfcli/cli/challenges.py", line 617, in install
challenge_instance.sync(ignore=ignore)
File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ctfcli/core/challenge.py", line 589, in sync
local_files = {f.split("/")[-1]: f for f in self.get("files", [])}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable