diff --git a/code/app.py b/code/app.py index 981c2ab..ee98d06 100644 --- a/code/app.py +++ b/code/app.py @@ -97,7 +97,6 @@ def upload(name = None, token = None): (ok,share) = get_share(name, token = token) if not ok: notify({ - "recipient": get_or_none('recipient', share), "share": name, "operation": "unauthorized_upload" }) @@ -137,7 +136,6 @@ def upload_join_splitted(name, token): (ok,share) = get_share(name, token = token) if not ok: notify({ - "recipient": get_or_none('recipient', share), "share": name, "operation": "unauthorized_split_upload" }) @@ -193,7 +191,6 @@ def upload_url(): (ok,share) = get_share(name) if not ok: notify({ - "recipient": get_or_none('recipient', share), "share": name, "operation": "unauthorized_URL_upload" }) @@ -278,7 +275,6 @@ def list_view(name, token = None): (ok,share) = get_share(name, token = token) if not ok: notify({ - "recipient": get_or_none('recipient', share), "share": name, "operation": "unauthorized_list" }) @@ -381,7 +377,6 @@ def download_zip(name, token = None): (ok,share) = get_share(name, token = token) if not ok: notify({ - "recipient": get_or_none('recipient', share), "share": name, "operation": "unauthorized_zip_download" }) @@ -409,7 +404,6 @@ def script_client(name = None, token = None): (ok,share) = get_share(name, token = token) if not ok: notify({ - "recipient": get_or_none('recipient', share), "share": name, "operation": "unauthorized_script_client" }) @@ -602,7 +596,6 @@ def download_file(name, filename, token = None): (ok,share) = get_share(name, token = token) if not ok: notify({ - "recipient": get_or_none('recipient', share), "share": name, "operation": "unauthorized_download" }) diff --git a/code/notifier.py.template b/code/notifier.py.template index 461449d..28ab976 100644 --- a/code/notifier.py.template +++ b/code/notifier.py.template @@ -7,7 +7,8 @@ class Notifier: pass def notify(self, msg): self.output = open('/code/data/notifier.log','at') - msg['address'] = msg['environment']['HTTP_X_FORWARDED_FOR'] + if 'HTTP_X_FORWARDED_FOR' in msg['environment']: + msg['address'] = msg['environment']['HTTP_X_FORWARDED_FOR'] msg['date'] = datetime.now().isoformat() del msg['environment'] self.output.write(json.dumps(msg, sort_keys = True)+"\n")