-
Notifications
You must be signed in to change notification settings - Fork 62
Merge master to official for 2026.5 release #4491
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
Changes from all commits
37cf846
50a8dee
fb78ef0
a8ea7cb
4b05581
97bdccb
3b78809
cb1a99b
c673073
e5b289d
e053f09
7614a61
5e6d4ab
c9d1dce
e475266
3371926
242601d
967906e
f124c1d
0c4ea8d
e043d8f
4c34712
e9d7304
046e1b8
343d439
ab1b3ae
169e9f1
e7ed02c
71eb5ee
bbf224b
f225bab
118ecdb
a7010ff
36ca9f1
0284e27
dea527e
6f5e65a
6651ddb
dabb7f9
b29bce8
4921559
35d543d
0ea14c4
4a81282
024a94e
8556808
2cc0107
bccf642
42a8a28
29052ac
049b738
c626a3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,8 +20,10 @@ limitations under the License. | |
| using Amdocs.Ginger.Common; | ||
| using Amdocs.Ginger.Common.External.Configurations; | ||
| using System; | ||
| using System.Net; | ||
| using System.Net.Http; | ||
| using System.Text; | ||
| using System.Text.Json; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Amdocs.Ginger.CoreNET.External.WireMock | ||
|
|
@@ -99,7 +101,8 @@ public async Task<string> StartRecordingAsync(string targetUrl) | |
|
|
||
| using (HttpClient client = new HttpClient()) | ||
| { | ||
| var content = new StringContent($"{{\"targetBaseUrl\": \"{targetUrl}\"}}", Encoding.UTF8, "application/json"); | ||
| string json = JsonSerializer.Serialize(new { targetBaseUrl = targetUrl }); | ||
| var content = new StringContent(json, Encoding.UTF8, "application/json"); | ||
| HttpResponseMessage response = await client.PostAsync($"{NormalizeUrl(GingerCore.ValueExpression.PasswordCalculation(_baseUrl))}{StartRecordingEndpoint}", content); | ||
| response.EnsureSuccessStatusCode(); | ||
| return await response.Content.ReadAsStringAsync(); | ||
|
|
@@ -153,7 +156,19 @@ public async Task<string> CreateStubAsync(string stubMapping, string contentType | |
| { | ||
| contentType = "application/json"; | ||
| } | ||
| var content = new StringContent(stubMapping, Encoding.UTF8, contentType); | ||
|
|
||
| string body; | ||
| if (string.IsNullOrEmpty(stubMapping)) | ||
| { | ||
| body = stubMapping; | ||
| } | ||
| else | ||
| { | ||
| using JsonDocument doc = JsonDocument.Parse(stubMapping); | ||
| body = doc.RootElement.GetRawText(); | ||
| } | ||
|
|
||
| var content = new StringContent(WebUtility.HtmlEncode(body), Encoding.UTF8, contentType); | ||
|
Comment on lines
+160
to
+171
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: The expression Citations:
🏁 Script executed: cat -n Ginger/GingerCoreNET/External/WireMock/WireMockAPI.cs | sed -n '150,180p'Repository: Ginger-Automation/Ginger Length of output: 1628 🏁 Script executed: cat -n Ginger/GingerCoreNET/External/WireMock/WireMockAPI.cs | sed -n '215,240p'Repository: Ginger-Automation/Ginger Length of output: 1338 🏁 Script executed: head -30 Ginger/GingerCoreNET/External/WireMock/WireMockAPI.cs | cat -nRepository: Ginger-Automation/Ginger Length of output: 1181 Fix stub payload construction: null-safe content and no HTML encoding for JSON. There are two correctness issues:
Suggested fix- string body;
- if (string.IsNullOrEmpty(stubMapping))
- {
- body = stubMapping;
- }
- else
- {
- using JsonDocument doc = JsonDocument.Parse(stubMapping);
- body = doc.RootElement.GetRawText();
- }
-
- var content = new StringContent(WebUtility.HtmlEncode(body), Encoding.UTF8, contentType);
+ string body = string.IsNullOrWhiteSpace(stubMapping)
+ ? string.Empty
+ : JsonDocument.Parse(stubMapping).RootElement.GetRawText();
+
+ var content = new StringContent(body, Encoding.UTF8, contentType);
@@
- string body;
- if (string.IsNullOrEmpty(stubMapping))
- {
- body = stubMapping;
- }
- else
- {
- using JsonDocument doc = JsonDocument.Parse(stubMapping);
- body = doc.RootElement.GetRawText();
- }
+ string body = string.IsNullOrWhiteSpace(stubMapping)
+ ? string.Empty
+ : JsonDocument.Parse(stubMapping).RootElement.GetRawText();Also applies to: 222-233 🤖 Prompt for AI Agents |
||
| HttpResponseMessage response = await client.PostAsync($"{NormalizeUrl(GingerCore.ValueExpression.PasswordCalculation(_baseUrl))}{MappingEndpoint}", content); | ||
| response.EnsureSuccessStatusCode(); | ||
| return await response.Content.ReadAsStringAsync(); | ||
|
|
@@ -204,7 +219,18 @@ public async Task<string> UpdateStubAsync(string stubId, string stubMapping) | |
|
|
||
| using (HttpClient client = new HttpClient()) | ||
| { | ||
| var content = new StringContent(stubMapping, Encoding.UTF8, "application/json"); | ||
| string body; | ||
| if (string.IsNullOrEmpty(stubMapping)) | ||
| { | ||
| body = stubMapping; | ||
| } | ||
| else | ||
| { | ||
| using JsonDocument doc = JsonDocument.Parse(stubMapping); | ||
| body = doc.RootElement.GetRawText(); | ||
| } | ||
|
|
||
| var content = new StringContent(body, Encoding.UTF8, "application/json"); | ||
| HttpResponseMessage response = await client.PutAsync($"{NormalizeUrl(GingerCore.ValueExpression.PasswordCalculation(_baseUrl))}{MappingEndpoint}/{stubId}", content); | ||
| response.EnsureSuccessStatusCode(); | ||
| return await response.Content.ReadAsStringAsync(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,6 +22,7 @@ limitations under the License. | |||||||||||||||||||||
| using System; | ||||||||||||||||||||||
| using System.Collections.Generic; | ||||||||||||||||||||||
| using System.IdentityModel.Tokens.Jwt; | ||||||||||||||||||||||
| using System.Net; | ||||||||||||||||||||||
| using System.Net.Http; | ||||||||||||||||||||||
| using System.Threading.Tasks; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -104,8 +105,7 @@ private async Task<bool> GetToken() | |||||||||||||||||||||
| catch (Exception ex) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| var error = "Failed to get access token"; | ||||||||||||||||||||||
| Reporter.ToLog(eLogLevel.ERROR, $"{error}, Error :{ex.Message}"); | ||||||||||||||||||||||
| Reporter.ToLog(eLogLevel.ERROR, $"{error}, Error :{ex.Message}, InnerException:{ex.InnerException},StackTrace:{ex.StackTrace}"); | ||||||||||||||||||||||
| Reporter.ToLog(eLogLevel.ERROR, error, ex); | ||||||||||||||||||||||
| return false; | ||||||||||||||||||||||
|
Comment on lines
107
to
109
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the standard error-logging signature in this catch block. Line 108 uses Suggested fix- var error = "Failed to get access token";
- Reporter.ToLog(eLogLevel.ERROR, error, ex);
+ var error = $"Failed to get access token. {ex.Message}";
+ Reporter.ToLog(eLogLevel.ERROR, error);As per coding guidelines 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
@@ -245,11 +245,11 @@ private MultipartFormDataContent PrepareRequestDetailsForChat(string Question) | |||||||||||||||||||||
| var content = new MultipartFormDataContent | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| { new StringContent(Question), "question" }, | ||||||||||||||||||||||
| { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.Account)), "account" }, | ||||||||||||||||||||||
| { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DomainType)), "domainType" }, | ||||||||||||||||||||||
| { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.TemperatureLevel)), "temperatureVal" }, | ||||||||||||||||||||||
| { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.MaxTokenValue)), "maxTokensVal" }, | ||||||||||||||||||||||
| { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DataPath)), "dataPath" } | ||||||||||||||||||||||
| { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.Account) ?? string.Empty)), "account" }, | ||||||||||||||||||||||
| { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DomainType) ?? string.Empty)), "domainType" }, | ||||||||||||||||||||||
| { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.TemperatureLevel) ?? string.Empty)), "temperatureVal" }, | ||||||||||||||||||||||
| { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.MaxTokenValue) ?? string.Empty)), "maxTokensVal" }, | ||||||||||||||||||||||
| { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DataPath) ?? string.Empty)), "dataPath" } | ||||||||||||||||||||||
|
Comment on lines
+248
to
+252
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Answer: No— Citations:
Remove Lines 248-252 apply Suggested fix- { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.Account) ?? string.Empty)), "account" },
- { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DomainType) ?? string.Empty)), "domainType" },
- { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.TemperatureLevel) ?? string.Empty)), "temperatureVal" },
- { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.MaxTokenValue) ?? string.Empty)), "maxTokensVal" },
- { new StringContent(WebUtility.HtmlEncode(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DataPath) ?? string.Empty)), "dataPath" }
+ { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.Account) ?? string.Empty), "account" },
+ { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DomainType) ?? string.Empty), "domainType" },
+ { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.TemperatureLevel) ?? string.Empty), "temperatureVal" },
+ { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.MaxTokenValue) ?? string.Empty), "maxTokensVal" },
+ { new StringContent(CredentialsCalculation(WorkSpace.Instance.Solution.AskLisaConfiguration.DataPath) ?? string.Empty), "dataPath" }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| }; | ||||||||||||||||||||||
| return content; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User-facing message text is inaccurate — "less than 255" conflicts with the
> 255guard.The validation in
HTMLReportAttachmentConfigurationPage.xaml.csfires whenLength > 255, meaning a path of exactly 255 characters is valid. The current message text tells users to keep paths "less than 255 characters", which incorrectly implies 254 is the maximum.✏️ Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents