Commit 83c8aa2
committed
fix(cortex-common): fix validate_path_safe macOS symlink resolution
On macOS, temporary directories like /var/folders/... are actually symlinks
to /private/var/folders/... When validate_path_safe validates a non-existent
path, it would normalize (not canonicalize) the path, keeping /var/... format,
but the root would be canonicalized to /private/var/...
This caused the starts_with check to fail because /var/... doesn't start
with /private/var/...
Fix: When a non-existent path has an existing parent directory, canonicalize
the parent to resolve symlinks, then join with the filename.1 parent 9d29822 commit 83c8aa2
1 file changed
+21
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
235 | 255 | | |
236 | 256 | | |
237 | 257 | | |
| |||
0 commit comments