diff --git a/Octokit/Helpers/StringExtensions.cs b/Octokit/Helpers/StringExtensions.cs index 30526f831f..42ed83361f 100644 --- a/Octokit/Helpers/StringExtensions.cs +++ b/Octokit/Helpers/StringExtensions.cs @@ -73,6 +73,14 @@ public static Uri ExpandUriTemplate(this string template, object values) public static string ToRubyCase(this string propertyName) { Ensure.ArgumentNotNullOrEmptyString(propertyName, nameof(propertyName)); + + // If the entire property is already all upper case, then do not split it across + // word boundaries. For example, "UBUNTU" should not be changed to "u_b_u_n_t_u". + if (string.Equals(propertyName, propertyName.ToUpperInvariant(), StringComparison.Ordinal)) + { + return propertyName; + } + return string.Join("_", propertyName.SplitUpperCase()).ToLowerInvariant(); }