Fix icons for MIME types with "+"

fixes #99
This commit is contained in:
Douglas Christopher Wilson
2021-04-01 16:40:42 -04:00
parent 7bc2da919b
commit 4e7785c620
4 changed files with 3 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
unreleased
==========
* Fix icons for MIME types with `+`
* Fix text and json responses to match html sorting
* Show font icon for more font types
* Use 400 error on URI decode failure instead of 500

View File

@@ -416,7 +416,7 @@ function iconLookup(filename) {
// try by mime type
if (icons[mimetype]) {
return {
className: 'icon-' + mimetype.replace('/', '-'),
className: 'icon-' + mimetype.replace('/', '-').replace('+', '_'),
fileName: icons[mimetype]
};
}

0
test/fixtures/collect/sample.svg vendored Normal file
View File

View File

@@ -386,6 +386,7 @@ describe('serveIndex(root)', function () {
.expect(/icon-default/)
.expect(/icon-directory/)
.expect(/icon-image/)
.expect(/icon-image-svg_xml/)
.expect(/icon-txt/)
.expect(/icon-application-pdf/)
.expect(/icon-video/)