2
0
Fork 0

Corrected video ratio management (once again).

This commit is contained in:
Thomas Touhey 2018-07-30 14:34:58 +02:00
parent 638e5c9195
commit ec66264d81
No known key found for this signature in database
GPG Key ID: 2ECEB0517AD947FB
2 changed files with 2 additions and 2 deletions

View File

@ -156,7 +156,7 @@ __test_cases = {
'<p>[video]&lt;script&gt;alert(document.cookie)&lt;/script&gt;' \
'[/video]</p>',
'[video]https://www.youtube.com/watch?v=6odDOOyUawY[/video]': \
'<div class="video-wrapper"><iframe ' \
'<div class="video-wrapper" style="padding-bottom: 56.25%"><iframe ' \
'src="https://www.youtube.com/embed/6odDOOyUawY" ' \
'frameborder="0" allowfullscreen></iframe></div>',
'[video]https://www.youtube.com/watch?v=<script>alert(1)</script>': \

View File

@ -97,7 +97,7 @@ class VideoTag(_BlockTag):
elif hasattr(self._video, 'ratio'):
ratio = self._video.ratio * 100
else:
ratio = round(_defaultratio_w / _defaultratio_h, 4)
ratio = round(_defaultratio_h / _defaultratio_w, 4) * 100
iratio = int(ratio)
if ratio == iratio:
ratio = iratio