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

Make normalizePath() not forget leading ../ #139

Merged
merged 1 commit into from Oct 3, 2016
Merged

Conversation

@spaze
Copy link
Contributor

spaze commented Oct 1, 2016

Fixes #138 by just remembering these .. parts and the add them to the rest when normalizing the path

Thanks for considering this fix!

We just remember these and the add them to the rest of the parts
@spaze spaze changed the title Make normalizePath() not forget leading ../, fixes #138 Make normalizePath() not forget leading ../ Oct 1, 2016
@dg

This comment has been minimized.

Copy link
Member

dg commented on src/Latte/Loaders/FileLoader.php in 0e77afd Oct 3, 2016

More simple solution is to replace if ($part === '..' && $res) { with if ($part === '..' && $res && end($res) !== '..') {

@OzzyCzech

This comment has been minimized.

Copy link

OzzyCzech commented on src/Latte/Loaders/FileLoader.php in 0e77afd Oct 3, 2016

I have double directory separator in main path, that cause missing key in path

echo $this->getReferredName('../foo/bar.latte', '/var/www/html/public/pages//layout.latte');

returns

/var/www/html/public/pages/foo/bar.latte

Solution can be add array_filter(explode('/', strtr($path, '\\', '/')))

@dg dg merged commit 3bcee1f into nette:master Oct 3, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.006%) to 93.714%
Details
dg added a commit that referenced this pull request Oct 3, 2016
@spaze

This comment has been minimized.

Copy link
Contributor Author

spaze commented Oct 3, 2016

@dg That's much nicer, indeed! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.