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

relative paths handling #6

Open
plee-nm opened this issue Jun 30, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@plee-nm
Copy link

commented Jun 30, 2017

Is it documented that relative paths aren't handled or is this a bug?

const pathIsInside = require("path-is-inside")
const {normalize} = require('path');

const relativePath = '/a/b/c/../../';
const inside = '/a/b';

console.log(`checking to see if ${normalize(relativePath)} is inside of ${inside}`);

console.log(pathIsInside(relativePath, inside));
console.log(pathIsInside('/a/', inside));

https://runkit.com/plee-nm/runkit-npm-path-is-inside

@domenic

This comment has been minimized.

Copy link
Owner

commented Jun 30, 2017

It should be documented. Pull request welcome.

@digitalica

This comment has been minimized.

Copy link

commented Nov 25, 2018

i think it would make more sense to handle it, so path.normalize() the paths before comparison. As then the 'isInside' question would be answered more correctly... This would be a breaking (the functionality, not the docs ;-) ) change though.

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