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

Fixed PathTooLongException for boundary case of directory name length in Path.NormalizePath #437

Merged
merged 1 commit into from
Apr 24, 2018

Conversation

okrushelnitsky
Copy link
Contributor

@okrushelnitsky okrushelnitsky commented Apr 24, 2018

There is a problem with paths that contain components with maximum length (255 chars in Windows). This paths are valid but Path.NormalizePath method throws exception PathTooLongException. Path.NormalizePath has checks for length of path components but this checks contains miscalculation for one char.

@Yomodo Yomodo merged commit 39f2095 into alphaleonis:develop Apr 24, 2018
@Yomodo
Copy link
Collaborator

Yomodo commented Apr 24, 2018

Thanks!

@okrushelnitsky
Copy link
Contributor Author

No problem.

@Yomodo Yomodo added this to the vNext milestone Apr 25, 2018
@Yomodo
Copy link
Collaborator

Yomodo commented May 9, 2018

This fix causes a unit test to fail: DirectoryInfo_CatchPathTooLongException_FolderNameGreaterThan255Characters_LocalAndNetwork_Success()

How does your path look like?

Yomodo added a commit that referenced this pull request May 9, 2018
@okrushelnitsky
Copy link
Contributor Author

okrushelnitsky commented May 10, 2018

Sorry, I wrongly interpreted condition after normalization 'while' cycle in NormalizePath. Condition in 'while' cycle I fixed rightly.

The path looks like:
E:\temp\<255 chars>\testfile.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants