Skip to content

[filesystem] makeRelativePath does not work correctly from root #14066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jaytaph opened this issue Mar 26, 2015 · 0 comments
Closed

[filesystem] makeRelativePath does not work correctly from root #14066

jaytaph opened this issue Mar 26, 2015 · 0 comments

Comments

@jaytaph
Copy link
Contributor

jaytaph commented Mar 26, 2015

When using makeRelativePath, it returns an incorrect path when trying to fetch an entry from the root:

  $fs->makePathRelative('/foo/bar/baz', '/');

Actual result:

  ../foo/bar/baz

Expected result:

  foo/bar/baz

As we have specified an absolute path, there is no point on having an .. added. It works, because a root directory has a .. which points to itself, but it could result in issues when the relative path is actually prefixed or concatted.

fabpot added a commit that referenced this issue Oct 16, 2015
… root (jaytaph, fabpot)

This PR was merged into the 2.3 branch.

Discussion
----------

[filesystem] makeRelativePath does not work correctly from root

| Q             | A
| ------------- | ---
| Bug fix?      | yes/no
| New feature?  | yes/no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #1234
| License       | MIT
| Doc PR        | #14066, #14067

When using `makeRelativePath`, it returns an incorrect path when trying to fetch an entry from the root:

      $fs->makePathRelative('/foo/bar/baz', '/');

Actual result:

      ../foo/bar/baz

Expected result:

      foo/bar/baz

As we have specified an absolute path, there is no point on having an `..` added. It works, because a root directory has a `..` which points to itself, but it could result in issues when the relative path is actually prefixed or concatted.

Commits
-------

791b124 fixed CS
7bb394e Added separated handling of root paths
@fabpot fabpot closed this as completed Oct 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants