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

Invalid validation IsChildOf #4

Closed
janssenMA opened this issue Nov 23, 2015 · 1 comment
Closed

Invalid validation IsChildOf #4

janssenMA opened this issue Nov 23, 2015 · 1 comment

Comments

@janssenMA
Copy link

janssenMA commented Nov 23, 2015

The method IsChildOf returns an invalid result in the following test-case:
parentDirectory = new String("D:/Foo").ToAbsoluteDirectoryPath();
m_PathString = new String("D:/Foo bar").ToAbsoluteDirectoryPath();

public bool IsChildOf(IDirectoryPath parentDirectory) {
            Debug.Assert(parentDirectory != null);
            string parentPathLowerCase = parentDirectory.ToString().ToLower();
            string thisPathLowerCase = m_PathString.ToLower();
            ...
            return thisPathLowerCase.IndexOf(parentPathLowerCase) == 0;
}

thisPathLowerCase.IndexOf(parentPathLowerCase) === 0 will result in true, but m_PathString is no child of parentDirectory.

@ndepend
Copy link
Owner

ndepend commented Nov 23, 2015

Fixed, thanks for this feedback!

63f9484

Unfortunately github wasn't showing up this commit straight, so I revert it a first time, and then both commits shown up, so I reverted it again.

2c18a35
8504c6b

Not sure if one needs to wait until github show a commit? Anyway I downloaded the zip and it looks like the fix is in there.

@ndepend ndepend closed this as completed Nov 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants