Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
100e43d1
Unverified
Commit
100e43d1
authored
Feb 16, 2021
by
seb-b
Committed by
GitHub
Feb 16, 2021
Browse files
Merge pull request #62 from jkevingutierrez/patch-2
Fix mimetype when the URL has params
parents
155f7398
5d07cbeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
wagtailvideos/models.py
View file @
100e43d1
...
...
@@ -172,6 +172,11 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
def
file_ext
(
self
):
return
os
.
path
.
splitext
(
self
.
filename
())[
1
][
1
:]
@
property
def
content_type
(
self
):
mime
=
mimetypes
.
MimeTypes
()
return
mime
.
guess_type
(
self
.
url
)[
0
]
or
mime
.
guess_type
(
self
.
filename
())[
0
]
def
is_editable_by_user
(
self
,
user
):
from
wagtailvideos.permissions
import
permission_policy
return
permission_policy
.
user_has_permission_for_instance
(
user
,
'change'
,
self
)
...
...
@@ -200,9 +205,8 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
for
transcode
in
transcodes
:
sources
.
append
(
"<source src='{0}' type='video/{1}' >"
.
format
(
transcode
.
url
,
transcode
.
media_format
.
name
))
mime
=
mimetypes
.
MimeTypes
()
sources
.
append
(
"<source src='{0}' type='{1}'>"
.
format
(
self
.
url
,
mime
.
guess_type
(
self
.
url
)[
0
]
))
.
format
(
self
.
url
,
self
.
content_type
))
sources
.
append
(
"<p>Sorry, your browser doesn't support playback for this video</p>"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment