From 32dd1d501105c88593d5c598561a5b1defb693a0 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 2 Sep 2024 08:32:36 +0300 Subject: [PATCH] Fixed: ToIntVersion overflow --- src/ServarrAPI/Datastore/Migration/002_break_up_version.cs | 6 +++--- src/ServarrAPI/Extensions/VersionExtensions.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ServarrAPI/Datastore/Migration/002_break_up_version.cs b/src/ServarrAPI/Datastore/Migration/002_break_up_version.cs index 1d42e3c..56b3485 100644 --- a/src/ServarrAPI/Datastore/Migration/002_break_up_version.cs +++ b/src/ServarrAPI/Datastore/Migration/002_break_up_version.cs @@ -19,9 +19,9 @@ protected override void MainDbUpgrade() // Create a sortable integer for version that can easily be compared against a max version, // supports any major, minor to 99, patch to 99, builds up to 999,999. Execute.Sql("UPDATE update SET intversion = " + - "((string_to_array(version, '.')::int[])[1] * 10000000000) + " + - "((string_to_array(version, '.')::int[])[2] * 100000000) + " + - "((string_to_array(version, '.')::int[])[3] * 1000000) + " + + "((string_to_array(version, '.')::int[])[1] * 10000000000L) + " + + "((string_to_array(version, '.')::int[])[2] * 100000000L) + " + + "((string_to_array(version, '.')::int[])[3] * 1000000L) + " + "((string_to_array(version, '.')::int[])[4])"); } } diff --git a/src/ServarrAPI/Extensions/VersionExtensions.cs b/src/ServarrAPI/Extensions/VersionExtensions.cs index a2eec53..d1d99b4 100644 --- a/src/ServarrAPI/Extensions/VersionExtensions.cs +++ b/src/ServarrAPI/Extensions/VersionExtensions.cs @@ -6,7 +6,7 @@ public static class VersionExtensions { public static long ToIntVersion(this Version version) { - return (version.Major * 10000000000) + (version.Minor * 100000000) + (version.Build * 1000000) + version.Revision; + return (version.Major * 10000000000L) + (version.Minor * 100000000L) + (version.Build * 1000000L) + version.Revision; } } }