From 9c3d22a44591048fa75478001a53b0869039be0c Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Wed, 28 Aug 2019 16:31:13 -0300 Subject: [PATCH] Trata URL mal formada do YouTube --- sapl/base/templatetags/common_tags.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py index 12192ab6f..048778d8d 100644 --- a/sapl/base/templatetags/common_tags.py +++ b/sapl/base/templatetags/common_tags.py @@ -249,8 +249,10 @@ def facebook_url(value): def youtube_id(value): from urllib.parse import urlparse, parse_qs u_pars = urlparse(value) - quer_v = parse_qs(u_pars.query).get('v')[0] - return quer_v + quer_v = parse_qs(u_pars.query).get('v') + if quer_v: + return quer_v[0] + return '' @register.filter