Skip to content

Commit

Permalink
Update regex
Browse files Browse the repository at this point in the history
  • Loading branch information
dzcpy committed Feb 3, 2015
1 parent 0ad4919 commit 4585109
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ function send(ctx, path, opts) {
*/

function isHidden(path) {
// unescaped version: /[/\].(?!.[/\])/
// [\/] matches a path separator, . matches leading dot
// unescaped version: /(^|[/\]).(?!.[/\])/
// (^|[\/]) matches a path separator or start of the string, . matches leading dot
// while (?!.[/\]) makes sure that something like /../ should not be matched
// and is passed to resove-path to get the correct error response
return /[\\\/]\.(?!\.[\\\/])/.test(path);
return /(^|[\\\/])\.(?!\.[\\\/])/.test(path);
}

/**
Expand Down

0 comments on commit 4585109

Please sign in to comment.