Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Filesystem] normalize paths before making them relative#22133

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:2.7fromxabbuh:issue-22083
Mar 24, 2017

Conversation

@xabbuh
Copy link
Member

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#22083
LicenseMIT
Doc PR

array('/aa/../bb/cc','/aa/dd/..','../bb/cc/'),
array('/aa/bb/../../cc','/aa/../dd/..','cc/'),
array('../aa/bb/cc','/aa/dd/..','bb/cc/'),
array('../../aa/../bb/cc','/aa/dd/..','../bb/cc/'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

These two are not absolute paths while makePathRelative() says it accepts two absolute paths.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Agree. Also this doesn't make sense. If the target path is already relative, what is it relative against? So just removing the leading dot segments changes the path as it's not clear what to refers to. So either you throw an exception that this is not accepted, or you can just return the relative target path as-is, since it is already relative. The latter is what I did inhttps://github.com/guzzle/psr7/blob/master/src/UriResolver.php#L149

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

👍 for returning as is.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

oops, that was not intended, fixed

@fabpot
Copy link
Member

Thank you@xabbuh.

@fabpotfabpot merged commitd50ffa1 intosymfony:2.7Mar 24, 2017
fabpot added a commit that referenced this pull requestMar 24, 2017
…xabbuh)This PR was merged into the 2.7 branch.Discussion----------[Filesystem] normalize paths before making them relative| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#22083| License       | MIT| Doc PR        |Commits-------d50ffa1 normalize paths before making them relative
@xabbuhxabbuh deleted the issue-22083 branchMarch 25, 2017 06:40
This was referencedApr 4, 2017
@leofeyer
Copy link
Contributor

Unfortunately, the unit tests for this change have not been comprehensive, so we didn't realize that the change breaks backwards compatibility (see#22321).

fabpot added a commit that referenced this pull requestSep 17, 2017
This PR was squashed before being merged into the 2.7 branch (closes#22321).Discussion----------[Filesystem] Fixed makePathRelative| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | n/a| License       | MIT| Doc PR        | n/aUpdating to Symfony 3.2.7@agoat noticed a bug with `Filesystem::makePathRelative()` incontao/core-bundle#751:- In Symfony 3.2.6 `makePathRelative('aa/cc', 'bb/cc')` returned correctly `../../aa/cc`- In Symfony 3.2.7 the same method call returns `./`I think this issue was introduced with#22133.While working on the fix I noticed some other issues too:- An unnecessary if construct that did nothing,fc745f4- Missing normalization of `./` path segments,15982d4- `../` got ignored at the beginning of relative paths,9586e88- The documentation of the method only allowed absolute paths, but there are already unit tests ([FilesystemTest.php:1097](https://github.com/symfony/symfony/blob/ab93feae3f9a16c4f18c5736435d18fa36338d2c/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php#L1097)) that test the behavior of relative paths,cec473eThis pull request fixes all these issues and adds tests for them.Commits-------2bc1150 [Filesystem] Fixed makePathRelative
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

3 more reviewers

@jakzaljakzaljakzal left review comments

@TobionTobionTobion left review comments

@ro0NLro0NLro0NL left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

8 participants

@xabbuh@fabpot@leofeyer@jakzal@Tobion@ro0NL@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp