Commit baff2964 authored by Miguel Alatzar's avatar Miguel Alatzar Committed by Miguel Alatzar
Browse files

Ensure extension is lower case prior to looking up MIME type (#819)

* Ensure extension is lower case prior to looking up MIME type

* Fix style
parent b822ad8d
......@@ -68,7 +68,7 @@ export function lookupMimeType(filename: string): string {
buildExtToMime();
}
const ext = filename.split('.').pop();
const ext = filename.split('.').pop().toLowerCase();
return extToMime[ext] || 'application/octet-stream';
}
......
......@@ -50,4 +50,13 @@ describe('FileUtils', () => {
assert.deepEqual(FileUtils.sortFileInfos(testCase.inputFileInfos), testCase.outputFileInfos);
});
});
it('lookupMimeType', () => {
const jpgFilePaths = ['file://aaa.jpg', 'file://bbb.JPG'];
const mimeType = 'image/jpeg';
jpgFilePaths.forEach((filePath) => {
assert.equal(FileUtils.lookupMimeType(filePath), mimeType);
});
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment