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

Missing URL to Wikipages triggers HTTP 500 #248

Open
Hetti opened this issue Mar 24, 2024 · 0 comments
Open

Missing URL to Wikipages triggers HTTP 500 #248

Hetti opened this issue Mar 24, 2024 · 0 comments

Comments

@Hetti
Copy link
Member

Hetti commented Mar 24, 2024

Pull Request #239 introduced a bug, that it will throw a HTTP 500 error if no wiki page is provided.

How to Reproduce:

  1. go to https://metalab.at/calendar/
  2. be logged in
  3. create an event with with no URL for wikipage provided
  4. 500 🎉

Error (exceprt) as seen below

  File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/d>
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/cal/views.py", line 195, in update_event
    if event_form.is_valid():
       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/forms/forms.py>
    return self.is_bound and not self.errors
                                 ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/forms/forms.py>
    self.full_clean()
  File "/usr/local/lib/python3.11/site-packages/django/forms/forms.py>
    self._clean_form()
  File "/usr/local/lib/python3.11/site-packages/django/forms/forms.py>
    cleaned_data = self.clean()
                   ^^^^^^^^^^^^
  File "/code/cal/forms.py", line 31, in clean
    wikipage, _ = re.subn(r'(^http(s)://metalab.at/wiki/|\ |\%|\&)', >
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^>
  File "/usr/local/lib/python3.11/re/__init__.py", line 196, in subn
    return _compile(pattern, flags).subn(repl, string, count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'
@Hetti Hetti added the bug label Mar 24, 2024
@luto luto added this to the MOS Hackathon 2024_02 milestone Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants