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

Comments

Projects
None yet
2 participants
@janssenMA

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.

@psmacchia

This comment has been minimized.

Show comment
Hide comment
@psmacchia

psmacchia Nov 23, 2015

Owner

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.

Owner

psmacchia 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.

@psmacchia psmacchia closed this Nov 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment