mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-09 20:19:44 +00:00
Make lbry.getMediaType() able to use MIME type as well as file name
This commit is contained in:
parent
b39d313776
commit
bc129eb347
1 changed files with 18 additions and 14 deletions
|
@ -283,7 +283,10 @@ lbry.imagePath = function(file)
|
|||
return lbry.rootPath + '/img/' + file;
|
||||
}
|
||||
|
||||
lbry.getMediaType = function(filename) {
|
||||
lbry.getMediaType = function(contentType, fileName) {
|
||||
if (contentType) {
|
||||
return /^[^/]+/.exec(contentType);
|
||||
} else {
|
||||
var dotIndex = filename.lastIndexOf('.');
|
||||
if (dotIndex == -1) {
|
||||
return 'unknown';
|
||||
|
@ -300,6 +303,7 @@ lbry.getMediaType = function(filename) {
|
|||
return 'unknown';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lbry.stop = function(callback) {
|
||||
lbry.call('stop', {}, callback);
|
||||
|
|
Loading…
Add table
Reference in a new issue