Skip to content

Long UNC pathname containing forward-slash (/) path separators is not normalised correctly #97

Description

@MarkCranness

This long path:

\\server\share\Folder\Folder\Folder\11111111-2222-3333-4444-555555555555\Folder\Clients/1234/1\11111 - FW Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam, quis nostrud.msg

... is normalised to:

\\?\UNC\server\share\Folder\Folder\Folder\11111111-2222-3333-4444-555555555555\Folder\Clients/1234/1\11111 - FW Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam, quis nostrud.msg

(Note: embedded "/" path separators at "\Clients/1234/1", which cause Windows errors.)

(If instead the pathname starts with a drive letter, then the "/" path separators are changed to "\" characters, and the same should happen with UNC pathnames.)

A fix might be to change lines 110 thru 111 of Path.cs like so:

var rootPathLength = 3 + uri.Host.Length;
maxPathLimit -= rootPathLength;
path = path.Replace(AltDirectorySeparatorChar, DirectorySeparatorChar);
}

Activity

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

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