Repository: LMFDB/lmfdb

Issue:
error parsing old newspace/newform label?
```
Traceback (most recent call last):
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/lmfdb/lmfdb-git-web/lmfdb/classical_modular_forms/main.py", line 445, in by_url_space_conreylabel
    return redirect(url_for_label(label), code=301)
  File "/home/lmfdb/lmfdb-git-web/lmfdb/classical_modular_forms/main.py", line 480, in url_for_label
    slabel = label.split(".")
AttributeError: 'NoneType' object has no attribute 'split'
[2020-09-11 05:52:42 UTC] 500 error on URL https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/15/2/0/
```

and

```
Exception on /ModularForm/GL2/Q/holomorphic/1832/2/0/a/ [GET]
Traceback (most recent call last):
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/sage/sage-9.1/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/lmfdb/lmfdb-git-web/lmfdb/classical_modular_forms/main.py", line 456, in by_url_newform_conreylabel
    return redirect(url_for_label(label), code=301)
  File "/home/lmfdb/lmfdb-git-web/lmfdb/classical_modular_forms/main.py", line 480, in url_for_label
    slabel = label.split(".")
AttributeError: 'NoneType' object has no attribute 'split'
[2020-09-11 04:57:31 UTC] 500 error on URL https://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/1832/2/0/a/
```


Discussion:

Resolving patch:
diff --git a/lmfdb/classical_modular_forms/main.py b/lmfdb/classical_modular_forms/main.py
--- a/lmfdb/classical_modular_forms/main.py
+++ b/lmfdb/classical_modular_forms/main.py
@@ -478,6 +478,9 @@ def by_url_embedded_newform_label(level, weight, char_orbit_label, hecke_orbit,
 def url_for_label(label):
     if label == "random":
         return url_for("cmf.random_form")
+    if not label:
+        return abort(404, "Invalid label")
+
     slabel = label.split(".")
     if len(slabel) == 6:
         func = "cmf.by_url_embedded_newform_label"
@@ -490,7 +493,7 @@ def url_for_label(label):
     elif len(slabel) == 1:
         func = "cmf.by_url_level"
     else:
-        raise ValueError("Invalid label")
+        return abort(404, "Invalid label")
     keys = ['level', 'weight', 'char_orbit_label', 'hecke_orbit', 'conrey_index', 'embedding']
     keytypes = [POSINT_RE, POSINT_RE, ALPHA_RE, ALPHA_RE, POSINT_RE, POSINT_RE]
     for i in range (len(slabel)):


Test patch: