File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,11 @@ internal interface ISftpSession : ISubsystemSession
35
35
/// Resolves a given path into an absolute path on the server.
36
36
/// </summary>
37
37
/// <param name="path">The path to resolve.</param>
38
+ /// <param name="getRealPath">Boolean determining whether to get the ral path.</param>
38
39
/// <returns>
39
40
/// The absolute path.
40
41
/// </returns>
41
- string GetCanonicalPath ( string path ) ;
42
+ string GetCanonicalPath ( string path , bool getRealPath = true ) ;
42
43
43
44
Task < string > GetCanonicalPathAsync ( string path , CancellationToken cancellationToken ) ;
44
45
Original file line number Diff line number Diff line change @@ -89,13 +89,20 @@ internal void SendMessage(SftpMessage sftpMessage)
89
89
/// Resolves a given path into an absolute path on the server.
90
90
/// </summary>
91
91
/// <param name="path">The path to resolve.</param>
92
+ /// <param name="getRealPath">Boolean determining whether to get the real path.</param>
92
93
/// <returns>
93
94
/// The absolute path.
94
95
/// </returns>
95
- public string GetCanonicalPath ( string path )
96
+ public string GetCanonicalPath ( string path , bool getRealPath = true )
96
97
{
97
98
var fullPath = GetFullRemotePath ( path ) ;
98
99
100
+ if ( ! getRealPath )
101
+ {
102
+ // getRealPath set to false allows us to get a reference to the symbolic link itself and not to the file it points to.
103
+ return fullPath ;
104
+ }
105
+
99
106
var canonizedPath = string . Empty ;
100
107
101
108
var realPathFiles = RequestRealPath ( fullPath , nullOnError : true ) ;
You can’t perform that action at this time.
0 commit comments