Skip to content

Commit 5fdb99f

Browse files
dependabot[bot]Copilotbrendandburns
authored
Bump Fractions from 7.3.0 to 8.3.2 (#1736)
* Bump Fractions from 7.3.0 to 8.3.2 --- updated-dependencies: - dependency-name: Fractions dependency-version: 8.3.2 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Fix ResourceQuantity parsing: reject strings with multiple decimal points Fractions 8.x changed behavior so that Fraction.FromString("1.1.") no longer throws but returns 11/100. Add explicit validation to reject numeric parts containing more than one decimal point, preserving the original behavior and fixing QuantityValueTests.Parse CI failure. Agent-Logs-Url: https://github.com/kubernetes-client/csharp/sessions/b7732b0d-100b-4d92-99bf-354a97c23fc2 Co-authored-by: brendandburns <5751682+brendandburns@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: brendandburns <5751682+brendandburns@users.noreply.github.com>
1 parent 556574e commit 5fdb99f

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ItemGroup>
66
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.2" />
77
<PackageVersion Include="FluentAssertions" Version="8.9.0" />
8-
<PackageVersion Include="Fractions" Version="7.3.0" />
8+
<PackageVersion Include="Fractions" Version="8.3.2" />
99
<PackageVersion Include="JsonPatch.Net" Version="3.3.0" />
1010
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.6.0" />
1111
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.7" />

src/KubernetesClient/Models/ResourceQuantity.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,14 @@ public ResourceQuantity(string v)
142142
si = value.Length;
143143
}
144144

145-
var literal = Fraction.FromString(value.Substring(0, si), CultureInfo.InvariantCulture);
145+
var numericPart = value.Substring(0, si);
146+
var firstDot = numericPart.IndexOf('.');
147+
if (firstDot != -1 && numericPart.IndexOf('.', firstDot + 1) != -1)
148+
{
149+
throw new FormatException($"Unable to parse quantity \"{v}\": numeric part contains multiple decimal points");
150+
}
151+
152+
var literal = Fraction.FromString(numericPart, CultureInfo.InvariantCulture);
146153
var suffixer = new Suffixer(value.Substring(si));
147154

148155
_unitlessValue = literal.Multiply(Fraction.Pow(suffixer.Base, suffixer.Exponent));

0 commit comments

Comments
 (0)