Generic MIME types (file types) such as application/octet-stream can how have sub types for handlers (archive, info extract, ...)

+ Add Amiga DMS support via xdms
This commit is contained in:
Bryan Ashby 2018-06-02 16:06:04 -06:00
parent 95422f71ba
commit 3ecadebf91
5 changed files with 108 additions and 40 deletions

View file

@ -487,8 +487,19 @@ function populateFileEntryWithArchive(fileEntry, filePath, stepInfo, iterator, c
);
}
function getInfoExtractUtilForDesc(mimeType, descType) {
let util = _.get(Config, [ 'fileTypes', mimeType, `${descType}DescUtil` ]);
function getInfoExtractUtilForDesc(mimeType, filePath, descType) {
let fileType = _.get(Config, [ 'fileTypes', mimeType ] );
if(Array.isArray(fileType)) {
// further refine by extention
fileType = fileType.find(ft => paths.extname(filePath) === ft.ext);
}
if(!_.isObject(fileType)) {
return;
}
let util = _.get(fileType, `${descType}DescUtil`);
if(!_.isString(util)) {
return;
}
@ -508,7 +519,7 @@ function populateFileEntryInfoFromFile(fileEntry, filePath, cb) {
}
async.eachSeries( [ 'short', 'long' ], (descType, nextDesc) => {
const util = getInfoExtractUtilForDesc(mimeType, descType);
const util = getInfoExtractUtilForDesc(mimeType, filePath, descType);
if(!util) {
return nextDesc(null);
}