Skip to content

Commit

Permalink
Merge pull request #1920 from freelawproject/1911-blank-page-when-sea…
Browse files Browse the repository at this point in the history
…rching-by-citations

fix(opinion): Fix URL redirects when a citation's reporter is not found
  • Loading branch information
mlissner authored Feb 18, 2022
2 parents 4657e60 + aaa56d5 commit f5fe8cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
*.egg-info
.dmypy.json

# pyenv
# For a library or package, you might want to ignore these files since the
# code is intended to run in multiple environments; otherwise, check them in:
.python-version

# no compiled files!
*.class
*.pyc
Expand Down
6 changes: 4 additions & 2 deletions cl/opinion_page/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,6 @@ def citation_redirector(
This uses the same infrastructure as the thing that identifies citations in
the text of opinions.
"""

if request.method == "POST":
form = CitationRedirectorForm(request.POST)
if form.is_valid():
Expand Down Expand Up @@ -868,7 +867,10 @@ def citation_redirector(
slug_edition = {slugify(item): item for item in EDITIONS.keys()}
proper_reporter = slug_edition.get(SafeText(reporter), None)
if not proper_reporter:
return HttpResponse(status=404)
return throw_404(
request,
{"no_reporters": True, "reporter": reporter, "private": False},
)
# We have a reporter (show volumes in it), a volume (show cases in
# it), or a citation (show matching citation(s))
if proper_reporter and volume and page:
Expand Down

0 comments on commit f5fe8cc

Please sign in to comment.