Skip to content

Commit

Permalink
revert hardcoded seperators
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Sep 6, 2023
1 parent 2769b2c commit 04e2690
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ async function fastifyStatic (fastify, opts) {
const globPattern = '**/**'
const indexDirs = new Map()
const routes = new Set()
const winSeparatorRegex = /\\\\/g
const winSeparatorRegex = new RegExp(`\\${path.win32.sep}`, 'g')
const backslashRegex = /\\/g
const startForwardSlashRegex = /^\//
const endForwardSlashRegex = /\/$/
Expand All @@ -348,7 +348,7 @@ async function fastifyStatic (fastify, opts) {
const roots = Array.isArray(sendOptions.root) ? sendOptions.root : [sendOptions.root]
for (let i = 0; i < roots.length; ++i) {
const rootPath = roots[i]
const files = await globPromise(path.join(rootPath, globPattern).replace(winSeparatorRegex, '/'), { nodir: true, dot: opts.serveDotFiles })
const files = await globPromise(path.join(rootPath, globPattern).replace(winSeparatorRegex, path.posix.sep), { nodir: true, dot: opts.serveDotFiles })
const indexes = opts.index === undefined ? ['index.html'] : [].concat(opts.index)

for (let i = 0; i < files.length; ++i) {
Expand Down

0 comments on commit 04e2690

Please sign in to comment.