diff --git a/.gitignore b/.gitignore index 78de518..3e787cd 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ external-repos/ .env volumes .ruff_cache +.idea/ diff --git a/ctfpad/helpers.py b/ctfpad/helpers.py index 11e1e7d..48a3049 100644 --- a/ctfpad/helpers.py +++ b/ctfpad/helpers.py @@ -209,15 +209,17 @@ def ctftime_get_ctf_logo_url(ctftime_id: int) -> str: str: [description] """ default_logo = f"{STATIC_URL}images/{CTFPAD_DEFAULT_CTF_LOGO}" - try: - ctf_info = ctftime_get_ctf_info(ctftime_id) - logo = ctf_info.setdefault("logo", default_logo) - _, ext = os.path.splitext(logo) - if ext.lower() not in CTFPAD_ACCEPTED_IMAGE_EXTENSIONS: - return default_logo - except ValueError: - logo = default_logo - return logo + if ctftime_id != 0: + try: + ctf_info = ctftime_get_ctf_info(ctftime_id) + logo = ctf_info.setdefault("logo", default_logo) + _, ext = os.path.splitext(logo) + if ext.lower() not in CTFPAD_ACCEPTED_IMAGE_EXTENSIONS: + return default_logo + except ValueError: + logo = default_logo + return logo + return default_logo def send_mail(recipients: list, subject: str, body: str) -> bool: diff --git a/ctfpad/templates/ctfpad/challenges/create.html b/ctfpad/templates/ctfpad/challenges/create.html index 04d0741..fbc6d91 100644 --- a/ctfpad/templates/ctfpad/challenges/create.html +++ b/ctfpad/templates/ctfpad/challenges/create.html @@ -2,199 +2,185 @@ {% block content %} -
- -{% include 'snippets/formerror.html' %} - -
-
- - {% for message in messages %} -

{{ message }}

- {% endfor %} - -
-
-
- {% if form.name.value %} -

Updating Challenge {{ form.name.value }}

- {% else %} -

New Challenge

- {% endif %} -
-
- -
-
- {% csrf_token %} -