Commit 9db072f8 authored by Phil Hughes's avatar Phil Hughes

Merge branch '231488-file-icons-case-insensitive-extension' into 'master'

Make the file icons based on extensions case-insensitive

Closes #231488

See merge request gitlab-org/gitlab!37817
parents 9a1a4e25 182710db
......@@ -586,5 +586,16 @@ const fileNameIcons = {
};
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', () => {
fileName | iconName
${'test.js'} | ${'javascript'}
${'test.png'} | ${'image'}
${'test.PNG'} | ${'image'}
${'.npmrc'} | ${'npm'}
${'.Npmrc'} | ${'file'}
${'webpack.js'} | ${'webpack'}
`('should render a $iconName icon based on file ending', ({ fileName, iconName }) => {
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