Browse Source

guess media type by filename extension when mimetype is missing

readme-update
Miguel Freitas 9 years ago
parent
commit
d6da998635
  1. 5
      js/interface_common.js

5
js/interface_common.js

@ -978,6 +978,11 @@ function startTorrentDownloadAndPreview(torrentId, previewContainer, isMedia) {
} }
function webtorrentFilePreview(file, 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) { if (isMedia) {
var imagePreview = $('<div class="image-preview" />'); var imagePreview = $('<div class="image-preview" />');
previewContainer.append(imagePreview); previewContainer.append(imagePreview);

Loading…
Cancel
Save