From f8d1cd6c85f9274bc6e95d04c2ae50fb009b664a Mon Sep 17 00:00:00 2001 From: Christopher F Date: Sun, 30 Sep 2018 17:40:30 -0400 Subject: [PATCH] fix: strip trailing slash from ratelimit bucket IDs This resolves #1125. fixes a bug where some ratelimit buckets would include a trailing slash, while others wouldn't; this would cause them to be treated as separate ratelimits, even though they are the same ideally this fix should change the ratelimit generator, but that code is pretty complicated and this was an easier fix that seems less likely to break things in the future. tested against normal bot function, all routes are assigned the proper buckets from my testing, so this should be good to go. --- src/Discord.Net.Rest/DiscordRestApiClient.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs index 1679579b2..e653a295e 100644 --- a/src/Discord.Net.Rest/DiscordRestApiClient.cs +++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs @@ -1415,6 +1415,9 @@ namespace Discord.API } format = builder.ToString(); + if (format.LastIndexOf('/') == format.Length-1) + format = format.Substring(0, format.Length - 1); // perf: change the code above so this isn't necessary + return x => string.Format(format, x.ToArray()); } catch (Exception ex)