(projectRoot: string, filePath: string)
| 94 | * contents get served — those must keep the symlink-aware check (#527). |
| 95 | */ |
| 96 | export function lexicalPathWithinRoot(projectRoot: string, filePath: string): string | null { |
| 97 | const resolved = path.resolve(projectRoot, filePath); |
| 98 | return isWithinDir(resolved, path.resolve(projectRoot)) ? resolved : null; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Validate that a file path stays within the project root, resolving symlinks. |
no test coverage detected