Skip to content

Invalid validation IsChildOf #4

Description

@janssenMA

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions