Commit 182710db authored by André Luís's avatar André Luís

Make file icons extensions case-insensitive

parent f3caeb39
...@@ -586,5 +586,16 @@ const fileNameIcons = { ...@@ -586,5 +586,16 @@ const fileNameIcons = {
}; };
export default function getIconForFile(name) { export default function getIconForFile(name) {
return fileNameIcons[name] || fileExtensionIcons[name ? name.split('.').pop() : ''] || ''; return (
fileNameIcons[name] ||
fileExtensionIcons[
name
? name
.split('.')
.pop()
.toLowerCase()
: ''
] ||
''
);
} }
---
title: Make file icons extension detection be case-insensitive
merge_request: 37817
author:
type: fixed
...@@ -36,6 +36,9 @@ describe('File Icon component', () => { ...@@ -36,6 +36,9 @@ describe('File Icon component', () => {
fileName | iconName fileName | iconName
${'test.js'} | ${'javascript'} ${'test.js'} | ${'javascript'}
${'test.png'} | ${'image'} ${'test.png'} | ${'image'}
${'test.PNG'} | ${'image'}
${'.npmrc'} | ${'npm'}
${'.Npmrc'} | ${'file'}
${'webpack.js'} | ${'webpack'} ${'webpack.js'} | ${'webpack'}
`('should render a $iconName icon based on file ending', ({ fileName, iconName }) => { `('should render a $iconName icon based on file ending', ({ fileName, iconName }) => {
createComponent({ fileName }); createComponent({ fileName });
......
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