From 8e5b0ae2411a00b1063aab9a57a19de63e504757 Mon Sep 17 00:00:00 2001 From: dolauli Date: Thu, 2 Jun 2022 10:22:58 +0800 Subject: [PATCH 1/2] Fixed two minor issues - single quote related and uri.tostring related --- powershell/resources/psruntime/BuildTime/PsHelpers.cs | 3 ++- .../resources/runtime/csharp/pipeline/PipelineMocking.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/powershell/resources/psruntime/BuildTime/PsHelpers.cs b/powershell/resources/psruntime/BuildTime/PsHelpers.cs index 9958d642638..4f9aed43c14 100644 --- a/powershell/resources/psruntime/BuildTime/PsHelpers.cs +++ b/powershell/resources/psruntime/BuildTime/PsHelpers.cs @@ -39,9 +39,10 @@ public static IEnumerable GetModuleCmdlets(params string[] modulePa public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) { // https://stackoverflow.com/a/40969712/294804 + var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'"; var getCmdletsCommand = $@" $currentFunctions = Get-ChildItem function: -Get-ChildItem -Path '{scriptFolder}' -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem -Path {wrappedFolder} -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} "; return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); diff --git a/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs b/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs index 33810ca9f7e..dc49b77a518 100644 --- a/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs +++ b/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs @@ -229,7 +229,7 @@ public HttpResponseMessage LoadMessage(string rqKey) public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) { counter++; - var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri.AbsoluteUri}+{counter}"; switch (Mode) { From 53b87616caa25f2164fa7fc0bfe6b78e457c2a1a Mon Sep 17 00:00:00 2001 From: Xiaogang Date: Thu, 2 Jun 2022 13:42:51 +0800 Subject: [PATCH 2/2] Revert the change --- .../resources/runtime/csharp/pipeline/PipelineMocking.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs b/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs index dc49b77a518..6082ba80ed8 100644 --- a/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs +++ b/powershell/resources/runtime/csharp/pipeline/PipelineMocking.cs @@ -229,7 +229,7 @@ public HttpResponseMessage LoadMessage(string rqKey) public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) { counter++; - var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri.AbsoluteUri}+{counter}"; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; switch (Mode) { @@ -259,4 +259,4 @@ public async Task SendAsync(HttpRequestMessage request, IEv } } } -} \ No newline at end of file +}