(child: string, parent: string)
| 101 | } |
| 102 | |
| 103 | function pathInWorkingPath(child: string, parent: string): boolean { |
| 104 | const relativePath = relativeSafe(parent, child) |
| 105 | return relativePath !== '' && !relativePath.startsWith('..') |
| 106 | } |
| 107 | |
| 108 | function relativeSafe(from: string, to: string): string { |
| 109 | const fromParts = from.split(/[/\\]+/).filter(Boolean) |
no test coverage detected