Remove ? from path if no get parameters are given

This commit is contained in:
root 2023-06-02 12:43:44 +02:00
parent ee42c89f48
commit 1952578f71
1 changed files with 6 additions and 1 deletions

View File

@ -32,10 +32,15 @@ def log_the_request(response):
else: else:
referrer = request.referrer referrer = request.referrer
if request.full_path[-1] == '?':
full_path = request.full_path[:-1]
else:
full_path = request.full_path
log = { log = {
'remote_addr': request.remote_addr, 'remote_addr': request.remote_addr,
'remote_user': remote_user, 'remote_user': remote_user,
'url': request.full_path, 'url': full_path,
'date': now.strftime("%d/%b/%Y:%H:%M:%S %z"), 'date': now.strftime("%d/%b/%Y:%H:%M:%S %z"),
'referrer': referrer, 'referrer': referrer,
'user_agent': request.user_agent.string, 'user_agent': request.user_agent.string,