Skip to content

Commit

Permalink
Revert "try removing the regex while modifying the globPattern"
Browse files Browse the repository at this point in the history
This reverts commit baf24ce.
  • Loading branch information
gurgunday committed Sep 5, 2023
1 parent baf24ce commit 528fa38
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,14 @@ async function fastifyStatic (fastify, opts) {
})
}
} else {
const globPattern = '**'
const globPattern = '**/**'
const indexDirs = new Map()
const routes = new Set()

const winSeparatorRegex = new RegExp(`\\${path.win32.sep}`, 'g')

for (const rootPath of Array.isArray(sendOptions.root) ? sendOptions.root : [sendOptions.root]) {
const files = await glob(path.join(rootPath, globPattern), { follow: true, nodir: true, dot: opts.serveDotFiles })
const files = await glob(path.join(rootPath, globPattern).replace(winSeparatorRegex, path.posix.sep), { follow: true, nodir: true, dot: opts.serveDotFiles })
const indexes = typeof opts.index === 'undefined' ? ['index.html'] : [].concat(opts.index)

for (let file of files) {
Expand Down

0 comments on commit 528fa38

Please sign in to comment.