Skip to content
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

[Filesystem] Several issues with Filesystem::makePathRelative #25023

Closed
inso opened this issue Nov 18, 2017 · 7 comments
Closed

[Filesystem] Several issues with Filesystem::makePathRelative #25023

inso opened this issue Nov 18, 2017 · 7 comments

Comments

@inso
Copy link

inso commented Nov 18, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version master

Looking at the code of Filesystem::makePathRelative method I have found several issues:

  • Stripping of drive letter for arguments is done regardless of host OS but directory separator normalization is done only for Windows hosts.
  • There is no drive check for Windows paths, hence for the following case result will be invalid: (new Filesystem())->makePathRelative('C:/aa/bb/cc', 'D:/aa/dd/..') produces 'bb/cc/'
  • (new Filesystem())->makePathRelative('/aa/bb/cc', '/aa') produces 'bb/cc/' which is wrong since '/aa/bb/cc' can be the file path, the presence of trailing slash in the result should be based on presence of trailing slash in the $endPath argument.
@nicolas-grekas
Copy link
Member

@inso would you up to submit a PR to fix what you found?

@lainosantos
Copy link

Hello, there is any update for this issue?

Make relative path when the first argument is a file returns a wrong response, because it return a string with a slash at end.

@xabbuh
Copy link
Member

xabbuh commented May 27, 2019

@lainosantos Would you like to work on a fix?

@lainosantos
Copy link

@xabbuh , i'll do it. Thanks.

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@carsonbot
Copy link

Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3

@xabbuh
Copy link
Member

xabbuh commented Jan 2, 2021

The first issue has already been fixed in #36497.

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

7 participants