diff --git a/index.js b/index.js index 411cd8c..18b4a36 100644 --- a/index.js +++ b/index.js @@ -147,10 +147,11 @@ async function send (ctx, path, opts = {}) { */ function isHidden (root, path) { - const hiddenFileReg = new RegExp(`${sep}\\.`) - path = path.substr(root.length) - - return hiddenFileReg.test(path) + path = path.substr(root.length).split(sep) + for (let i = 0; i < path.length; i++) { + if (path[i][0] === '.') return true + } + return false } /**