SmartComboBox not working on a French computer
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 42/100
Research direction
Start in SmartComponents.AspNetCore/SmartComboBox/SmartComboBoxEndpointRouteBuilderExtensions.cs, especially the similarityThreshold parsing around line 38. Reproduce the endpoint request on a French-locale system and inspect how the submitted decimal is parsed. Done means a French-formatted threshold is accepted without a bad request while the shown required-field and maxResults validation remains intact.
Written by the indexing model from the issue text.
Description
There is a problem in \smartcomponents\src\SmartComponents.AspNetCore\SmartComboBox\SmartComboBoxEndpointRouteBuilderExtensions.cs:
var form = httpContext.Request.Form;
if (!(form.TryGetValue("inputValue", out var inputValue) && !string.IsNullOrEmpty(inputValue))
|| !(form.TryGetValue("maxResults", out var maxResultsString) && int.TryParse(maxResultsString, NumberStyles.Integer, CultureInfo.InvariantCulture, out var maxResults))
|| !(form.TryGetValue("similarityThreshold", out var similarityThresholdString) && float.TryParse(similarityThresholdString, NumberStyles.Float, CultureInfo.InvariantCulture, out var similarityThreshold)))
{
return Results.BadRequest("inputValue, maxResults, and similarityThreshold are required");
}
if (maxResults < 1 || maxResults > 100)
{
return Results.BadRequest("maxResults must be less than or equal to 100");
}
In Line 38, I had to change the code to make it work on my French PC because similarityThresholdString was "0,5" (with a coma) and this fails in the float.TryParse
Here is the fixed code:
var form = httpContext.Request.Form;
if (!(form.TryGetValue("inputValue", out var inputValue) && !string.IsNullOrEmpty(inputValue)))
{
return Results.BadRequest("inputValue is required");
}
if (!(form.TryGetValue("maxResults", out var maxResultsString) && int.TryParse(maxResultsString, NumberStyles.Integer, CultureInfo.InvariantCulture, out var maxResults)) )
{
return Results.BadRequest("maxResults is required");
}
if (!(form.TryGetValue("similarityThreshold", out var similarityThresholdString)))
{
return Results.BadRequest("similarityThreshold is required");
}
var similarityThreshold = float.Parse(similarityThresholdString.ToString().Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture);
if (maxResults < 1 || maxResults > 100)
{
return Results.BadRequest("maxResults must be less than or equal to 100");
}
- Dominant language
- C#
- Stars
- 510
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/smartcomponents
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
dotnet/smartcomponents#51 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
dotnet/smartcomponents#50 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dotnet/smartcomponents#49 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
dotnet/smartcomponents#47 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
dotnet/smartcomponents#46 ·
All issues in dotnet/smartcomponents
Similar issues
-
area:frontend bug FE P3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
klasolsson81/jobbliggaren#2010 ·
Maintainers usually reply within 1 day
-
agentic-workflows untriaged
Difficulty 1/5 Under an hour Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
area: homeblaze type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
RicoSuter/Namotion.Interceptor#630 ·
Maintainers usually reply within 1 day
-
Akka.Hosting enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
microsoft/microsoft-ui-xaml#12158 ·
Maintainers usually reply within 1 day