From b0fb52017c5f834a3117c4313a4ecb36b9fd9e6d Mon Sep 17 00:00:00 2001 From: Leigh Morresi <275001+dgtlmoon@users.noreply.github.com> Date: Wed, 24 Feb 2021 09:56:29 +0100 Subject: [PATCH] Handle the case of someone supplying a bad link --- backend/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/__init__.py b/backend/__init__.py index c5a055f0..101e0094 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -253,10 +253,12 @@ def changedetection_app(config=None, datastore_o=None): if uuid == 'first': uuid= list(datastore.data['watching'].keys()).pop() - extra_stylesheets = ['/static/css/diff.css'] - - watch = datastore.data['watching'][uuid] + try: + watch = datastore.data['watching'][uuid] + except KeyError: + messages.append({'class': 'error', 'message': "No history found for the specified link, bad link?"}) + return redirect(url_for('index')) dates = list(watch['history'].keys()) # Convert to int, sort and back to str again