jordanlytle / SmbAbstraction

Implements the System.IO.Abstractions interfaces for interacting with the filesystem, and adds support for interacting with UNC or SMB paths
MIT License
6 stars 8 forks source link

Fix path hostname resolution in DriveInfoFactory #32

Closed wgv-jxiao closed 4 years ago

wgv-jxiao commented 4 years ago

When video is playing, we created credentials for each video path. When requesting drive info at the same time, it may resolve to the credential to the video file instead of the drive. The path point to file failed to get drive information and caused exception. Fix to point to the SharePath as drive path.

Jo0 commented 4 years ago

I reverted this change. I'm adding tests around SMBDriveInfo.FromDriveName with file and directory paths. Without your changes, I'm not seeing the behavior you are describing, as PathExtensions.TryResolveHostnameFromPath tries to get the hostname out of the path we are trying to resolve. If PathExtensions.TryResolveHostnameFromPath doesn't work, that would mean calls everywhere else would fail.

If possible please provide the exception you are seeing for DriveInfo.

However, I will be providing an update and release for your SmbLibraryLite changes and fixing what credentials we retrieve in SMBDriveInfo.FromDriveName based on the path being passed in. Which may be the root cause of the issue you were seeing.