Commit 453eaf3d authored by David Haynes's avatar David Haynes 🙆

Merge branch '2.2-dev' into 103-flake8

parents d3a13d1c 21564865
Pipeline #1307 passed with stages
in 2 minutes and 56 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 doesExist.target is None:
return redirect('go/404.html')
# If the user is trying to make a Go link to itself, we 404 them
if url.target == 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