Skip to content

Make certain that path is relative before joining it to relativeTo#1547

Merged
hueniverse merged 10 commits intohapijs:masterfrom
andrewburgess:issue-1545
Apr 7, 2014
Merged

Make certain that path is relative before joining it to relativeTo#1547
hueniverse merged 10 commits intohapijs:masterfrom
andrewburgess:issue-1545

Conversation

@andrewburgess
Copy link
Copy Markdown
Contributor

This should fix the pathing logic for the File handler on Windows based systems.

Fixes #1545

@hueniverse
Copy link
Copy Markdown
Contributor

Need tests. Also was this tested with symbolic links on linux?

@hueniverse hueniverse added the bug label Apr 1, 2014
@andrewburgess
Copy link
Copy Markdown
Contributor Author

I'll add some tests.

In terms of symbolic links, I don't believe it should matter because the Path module primarily deals with string manipulation of paths. It wouldn't follow a symbolic link in this case.

@hueniverse
Copy link
Copy Markdown
Contributor

Node is stupid about symlinks so want to make sure.

@andrewburgess
Copy link
Copy Markdown
Contributor Author

Understandable.

https://github.com/joyent/node/blob/master/lib/path.js#L349
The posix version of normalize is completely string based.

https://github.com/joyent/node/blob/master/lib/path.js#L318
The posix version of resolve appears to be only string based as well (it does get process.cwd() but I don't think symlinks would affect that)

Regardless, I'll put some tests together to make sure that the paths resolve correctly.

@andrewburgess
Copy link
Copy Markdown
Contributor Author

Ok, I think I have things back up to parity with the builds before mine on master with regards to tests, including coverage.

There are still some additional areas where pathing can be fixed for Windows based systems. Might be able to augment with some of the changes in #1505 without the included dependency on another module.

@nlf nlf mentioned this pull request Apr 3, 2014
hueniverse pushed a commit that referenced this pull request Apr 7, 2014
Make certain that path is relative before joining it to relativeTo
@hueniverse hueniverse merged commit 83b4cde into hapijs:master Apr 7, 2014
@hueniverse hueniverse added this to the 3.2.0 milestone Apr 7, 2014
@hueniverse hueniverse self-assigned this Apr 7, 2014
@andrewburgess andrewburgess deleted the issue-1545 branch April 7, 2014 05:33
nintra added a commit to nintra/hoodie-server that referenced this pull request Mar 24, 2015
delete now superfluous 'remove drive letter of project_dir on windows'.
before this, also tests fail on windows at integration/handle_404
(expected 404 got 200). with this fix tests run fine.

this line was added in feb 2014. the hapi project fixed this shortly
after in march/april.

Remove assumption that all absolute paths start with '/'
hapijs/hapi#1505

Make certain that path is relative before joining it to relativeTo
hapijs/hapi#1547
@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Statics handler with the same directory path not work when in plugin (Win32)

2 participants