Commit 21564865 authored by David Haynes's avatar David Haynes 🙆
Browse files

Merge branch '145-linkNotFoundPage' into '2.2-dev'

Resolve "Display a "this link does not exist" page when navigating to a non existent Go link"

See merge request !95
parents 0f5f9af4 7933bb5f
Pipeline #1309 passed with stage
in 2 minutes and 10 seconds
......@@ -447,12 +447,16 @@ def redirection(request, short):
# Get the current domain info
domain = "%s://%s" % (request.scheme, request.META.get('HTTP_HOST')) + "/"
# Get the URL object that relates to the requested Go link
url = get_object_or_404(URL, short__iexact=short)
# Increment our clicks by one
url.clicks += 1
# Get the URL short link
doesExist = URL.objects.get(short__iexact=short)
# Checks to see if the link exists, if not we 404 the user.
if is None:
return redirect('go/404.html')
# If the user is trying to make a Go link to itself, we 404 them
if == domain + short:
return redirect('404.html')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment