You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#pragma warning disable SEC0116//Warning SEC0116 Unvalidated file paths are passed to a file delete API, which can allow unauthorized file system operations (e.g. read, write, delete) to be performed on unintended server files.
returnPath.GetFullPath(path);//GetFullPath: convert relative path to full path
80
+
81
+
78
82
//@"\\?\" prefix is needed for reading from long paths: https://stackoverflow.com/questions/44888844/directorynotfoundexception-when-using-long-paths-in-net-4-7 and https://superuser.com/questions/1617012/support-of-the-unc-server-share-syntax-in-windows
79
83
80
84
if(path.Substring(0,2)==@"\\")//network path or path already starting with \\?\
@@ -83,10 +87,20 @@ public static string GetLongPath(string path)
83
87
}
84
88
else
85
89
{
86
-
return@"\\?\"+path;
90
+
return@"\\?\"+Path.GetFullPath(path);//GetFullPath: convert relative path to full path
#pragma warning disable SEC0116//Warning SEC0116 Unvalidated file paths are passed to a file delete API, which can allow unauthorized file system operations (e.g. read, write, delete) to be performed on unintended server files.
0 commit comments