Commit b737bc83 authored by Jacotsu's avatar Jacotsu
Browse files

Now the click counter is not incremented when the referer header is

 an injection
parent c7ce14cf
......@@ -31,7 +31,6 @@ def handle_redirect(path):
if pure_string.match(path):
final_url = redis_store.get('url.' + path)
if final_url:
redis_store.incr('count.' + path)
referrer = flask.request.headers.get('referer')
if referrer:
safe_referrer = flask.escape(referrer)
......@@ -49,6 +48,8 @@ def handle_redirect(path):
redis_store.incr(redis_key_for_referrer_count(path,
safe_referrer))
app.logger.debug('Increased counter for {}'.format(safe_referrer))
redis_store.incr('count.' + path)
return flask.redirect(final_url)
else:
return flask.abort(404)
......
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