(path: string)
| 8 | // @note: we don't allow directory traversal |
| 9 | // or null bytes in the path. |
| 10 | export const isPathValid = (path: string) => { |
| 11 | const pathSegments = path.split('/'); |
| 12 | if (pathSegments.some(segment => segment === '..') || path.includes('\0')) { |
| 13 | return false; |
| 14 | } |
| 15 | |
| 16 | return true; |
| 17 | } |
| 18 | |
| 19 | export const normalizePath = (path: string): string => { |
| 20 | // Normalize the path by... |
no outgoing calls
no test coverage detected