Commit e94df0dc authored by Eyad Hasan's avatar Eyad Hasan
Browse files

Added comments

parent ed835333
Pipeline #1123 passed with stage
in 1 minute and 9 seconds
...@@ -345,15 +345,19 @@ def redirection(request, short): ...@@ -345,15 +345,19 @@ def redirection(request, short):
# Get the current domain info # Get the current domain info
domain = "%s://%s" % (request.scheme, request.META.get('HTTP_HOST')) + "/" domain = "%s://%s" % (request.scheme, request.META.get('HTTP_HOST')) + "/"
# Get the URL object that relates to the requested Go link # Get the URL object that relates to the requested Go link
url = get_object_or_404(URL, short__iexact=short) url = get_object_or_404(URL, short__iexact=short)
# Increment our clicks by one # Increment our clicks by one
url.clicks += 1 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 the user is trying to make a Go link to itself, we 404 them
if url.target == domain + short: if url.target == domain + short:
return redirect('admin/404.html') return redirect('go/404.html')
# If the user is coming from a QR request then increment qrclicks # If the user is coming from a QR request then increment qrclicks
if 'qr' in request.GET: if 'qr' in request.GET:
......
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