mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-02-05 03:24:17 +00:00
guess media type by filename extension when mimetype is missing
This commit is contained in:
parent
8a39eba6b6
commit
d6da998635
@ -978,6 +978,11 @@ function startTorrentDownloadAndPreview(torrentId, previewContainer, isMedia) {
|
||||
}
|
||||
|
||||
function webtorrentFilePreview(file, previewContainer, isMedia) {
|
||||
if (!isMedia) {
|
||||
// try guessing by filename extension
|
||||
isMedia = /^[^?]+\.(?:jpe?g|gif|png|mp4|webm|mp3|ogg|wav|)$/i.test(file.name)
|
||||
}
|
||||
|
||||
if (isMedia) {
|
||||
var imagePreview = $('<div class="image-preview" />');
|
||||
previewContainer.append(imagePreview);
|
||||
|
Loading…
x
Reference in New Issue
Block a user