Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File key not respecting null keys #163

Open
jimender2 opened this issue Nov 13, 2024 · 0 comments
Open

File key not respecting null keys #163

jimender2 opened this issue Nov 13, 2024 · 0 comments

Comments

@jimender2
Copy link

jimender2 commented Nov 13, 2024

Inside of most of the keys, it is optional to have values.

if challenge.get("tags"):

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?

local_files = {f.split("/")[-1]: f for f in self.get("files", [])}

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant