node-http-server – Blame information for rev 35
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
35 | office | 1 | #!/usr/bin/env node |
2 | |||
3 | /*************************************************************************/ |
||
4 | /* Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 */ |
||
5 | /*************************************************************************/ |
||
6 | |||
7 | // Checks whether userPath is a child of rootPath. |
||
8 | var was = { |
||
9 | isRooted: function(userPath, rootPath, separator, callback) { |
||
10 | userPath = userPath.split(separator).filter(Boolean); |
||
11 | rootPath = rootPath.split(separator).filter(Boolean); |
||
12 | callback(userPath.length >= rootPath.length && |
||
13 | rootPath.every((e, i) => e === userPath[i])); |
||
14 | } |
||
15 | } |
||
16 | |||
17 | module.exports = was; |