Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions packages/server/lib/middleware/serveIndex/serveIndex.cjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* serve-index
*
* Version: 1.9.1
* Version: 1.9.2
*
* Author: Douglas Christopher Wilson
* Web: https://github.com/expressjs/serve-index/tree/20e83c893b701c3a117a0f6836be0f5a818bb925
* Web: https://github.com/expressjs/serve-index/tree/6f86a185446a37a99b2cd9694ce93df996aeba6f
*
* Licensed under
* MIT License, see "/LICENSES/MIT.txt"
Expand Down Expand Up @@ -150,7 +150,7 @@ function iconLookup(filename) {
// try by mime type
if (icons[mimetype]) {
return {
className: "icon-" + mimetype.replace("/", "-"),
className: "icon-" + mimetype.replace("/", "-").replace("+", "_"),
fileName: icons[mimetype]
};
}
Expand Down Expand Up @@ -305,6 +305,8 @@ const icons = {
"image/svg+xml": "page_white_vector.png",
"text/css": "page_white_code.png",
"text/html": "page_white_code.png",
// mime-types resolves ".js"/".mjs" to "text/javascript"; keep the JS-specific icon
"text/javascript": "page_white_code_red.png",
"text/less": "page_white_code.png",

// other, extension-specific icons
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"express": "^4.22.2",
"fresh": "^0.5.2",
"graceful-fs": "^4.2.11",
"mime-types": "^2.1.35",
"mime-types": "^3.0.2",
"parseurl": "^1.3.3",
"portscanner": "^2.2.0",
"router": "^2.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/lib/server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ test("Get resource from application.a with replaced version placeholder (/versio
throw new Error(res.error);
}
t.is(res.statusCode, 200, "Correct HTTP status code");
t.regex(res.headers["content-type"], /application\/javascript/, "Correct content type");
t.regex(res.headers["content-type"], /text\/javascript/, "Correct content type");
// The 'minify' task rewrites the served file and appends a sourceMappingURL
t.is(res.text, "console.log(`1.0.0`);\n" + SOURCE_MAPPING_URL + "=versionTest.js.map", "Correct response");
});
Expand Down
6 changes: 3 additions & 3 deletions packages/server/test/lib/server/middleware/serveIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test.serial("serveIndex default", async (t) => {
"1.00 KB</span>"));
t.regex(content,
RegExp(
"<li><a href=\"/myFile2.js\" class=\"icon icon icon-js icon-application-javascript\" " +
"<li><a href=\"/myFile2.js\" class=\"icon icon icon-js icon-text-javascript\" " +
"title=\"myFile2.js\"><span class=\"name\">myFile2.js</span><span class=\"size\">" +
"1.00 MB</span>"));
t.regex(content,
Expand Down Expand Up @@ -115,7 +115,7 @@ test.serial("serveIndex no hidden", async (t) => {
"<span class=\"size\">1.00 KB</span>"));
t.regex(content,
RegExp(
"<li><a href=\"/myFile2.js\" class=\"icon icon icon-js icon-application-javascript\" " +
"<li><a href=\"/myFile2.js\" class=\"icon icon icon-js icon-text-javascript\" " +
"title=\"myFile2.js\"><span class=\"name\">myFile2.js</span>" +
"<span class=\"size\">1.00 MB</span>"));
t.regex(content,
Expand Down Expand Up @@ -210,7 +210,7 @@ test.serial("serveIndex no details", async (t) => {
"title=\"myFile1.meh\"><span class=\"name\">myFile1.meh</span>" +
"<span class=\"size\">1.00 KB</span>"));
t.regex(content, RegExp(
"<li><a href=\"/myFile2.js\" class=\"icon icon icon-js icon-application-javascript\" " +
"<li><a href=\"/myFile2.js\" class=\"icon icon icon-js icon-text-javascript\" " +
"title=\"myFile2.js\"><span class=\"name\">myFile2.js</span>" +
"<span class=\"size\">1.00 MB</span>"));
t.regex(content, RegExp(
Expand Down
Loading