From cfced13e4ab540025eb9644ea392ce490cfee749 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 11 Aug 2019 15:21:20 +0200 Subject: [PATCH] Fix template filter for videos --- utils/template_filters.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/template_filters.py b/utils/template_filters.py index 2f8b444..dd995e0 100644 --- a/utils/template_filters.py +++ b/utils/template_filters.py @@ -251,7 +251,12 @@ def get_attachment_url(url, size): @filters.app_template_filter() def get_video_url(url): - return _get_file_url(url, None, Kind.ATTACHMENT) + if isinstance(url, list): + for link in url: + if link.get("mimeType", "").startswith("video/"): + return _get_file_url(link.get("href"), None, Kind.ATTACHMENT) + else: + return _get_file_url(url, None, Kind.ATTACHMENT) @filters.app_template_filter()