Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion examples/api/simple/folder/simple.txt

This file was deleted.

25 changes: 13 additions & 12 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,17 +472,15 @@ class Server {
}
},
contentBaseIndex: () => {
if (this.serveIndex || typeof this.serveIndex === 'undefined') {
if (Array.isArray(contentBase)) {
contentBase.forEach((item) => {
app.get('*', serveIndex(item));
});
} else if (
!/^(https?:)?\/\//.test(contentBase) &&
typeof contentBase !== 'number'
) {
app.get('*', serveIndex(contentBase));
}
if (Array.isArray(contentBase)) {
contentBase.forEach((item) => {
app.get('*', serveIndex(item));
});
} else if (
!/^(https?:)?\/\//.test(contentBase) &&
typeof contentBase !== 'number'
) {
app.get('*', serveIndex(contentBase));
}
},
watchContentBase: () => {
Expand Down Expand Up @@ -555,7 +553,10 @@ class Server {

defaultFeatures.push('magicHtml');

if (contentBase !== false) {
if (
contentBase !== false &&
(options.serveIndex || typeof options.serveIndex === 'undefined')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use typeof, we prefer using !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

      (options.serveIndex || options.serveIndex === undefined)

@evilebottnawi done

) {
defaultFeatures.push('contentBaseIndex');
}
// compress is placed last and uses unshift so that it will be the first middleware used
Expand Down