SmartComboBox not working on a French computer
还没有人认领这个 Issue。
评估
调研方向
从 SmartComponents.AspNetCore/SmartComboBox/SmartComboBoxEndpointRouteBuilderExtensions.cs 开始,重点查看第 38 行附近对 similarityThreshold 的解析。在法语区域设置的系统上重现 endpoint 请求,并检查提交的小数是如何被解析的。完成的标准是:法语格式的 threshold 能够被接受而不会返回 Bad Request,同时现有的必填字段和 maxResults 验证仍保持不变。
由索引模型根据 Issue 内容生成。
描述
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");
}
- 主要语言
- C#
- 星标
- 510
- 派生
- 61
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotnet/smartcomponents 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 55/100
dotnet/smartcomponents#51 ·
-
难度 4/5 3-5 天 新手友好度 45/100
dotnet/smartcomponents#50 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
dotnet/smartcomponents#49 ·
-
难度 4/5 3-5 天 新手友好度 25/100
dotnet/smartcomponents#47 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 48/100
dotnet/smartcomponents#46 ·
查看 dotnet/smartcomponents 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
unoplatform/uno.check#591 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
weaviate/csharp-client#378 ·
-
agentic-workflows automated testing
难度 2/5 1-3 小时 新手友好度 85/100
Azure-Samples/Legacy-Modernization-Agents#194 ·
维护者通常 1 天内回复
-
area-encryption area-security p1-recommended technical-debt
难度 2/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复
-
bug flaky small
难度 2/5 1-3 小时 新手友好度 70/100
hexide-io/HexIDE#1906 · 1 条评论 ·
维护者通常 1 天内回复