Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in symlink traversal with indirect targets (#1084)
Summary: Pull Request resolved: #1084 Fixes a bug where symlinks beginning with indirections (`../`) may fail to traverse in some `projectRoot` / `watchFolders` configurations. This occurs due to incomplete "normalisation" of a symlink target in `metro-file-map`, relative to the project root. Given a project root of `/project` and a symlink `/project/src/link-to-foo -> ../../project/foo.js`, we would normalise the target to `../project/foo.js` rather than simply `foo.js` - we were not taking into account that further normalisation could be possible after joining with `projectRoot`. "Normal" paths are defined as being *fully* normalised relative to the project root. The unnecessary indirection out and back into the project root fails because `TreeFS` is a DAG, and internally there is no entry for `rootNode.get('..').get('project')` - this would be a cycle back to `rootNode`. Changelog: ``` * **[Fix]:** Symlinks with indirections may not be resolvable ``` Reviewed By: yungsters Differential Revision: D49323614 fbshipit-source-id: e01a10a0455b0af22ebc3cdd7c34ca8fd888d0f4
- Loading branch information