From 7b20f6d3b7bb55eb57049eaeedd476b1601dfca3 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 28 Nov 2020 20:29:55 +0100 Subject: [PATCH] Fix tests --- articles/context_processors.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/articles/context_processors.py b/articles/context_processors.py index cdbf1f4..5afecf8 100644 --- a/articles/context_processors.py +++ b/articles/context_processors.py @@ -45,9 +45,10 @@ def plausible(request): def open_graph_image_url(request): + if request.path in IGNORED_PATHS: + return {} open_graph_image = Attachment.objects.get_open_graph_image() - return { - "open_graph_image_url": open_graph_image.processed_file.get_full_absolute_url( - request - ) - } + url = "" + if open_graph_image: + url = open_graph_image.processed_file.get_full_absolute_url(request) + return {"open_graph_image_url": url}