From ae2258bc7a5b529cea60e1c13d0986ffb1c025a5 Mon Sep 17 00:00:00 2001 From: Glenn Griffin Date: Thu, 21 Nov 2019 11:21:39 -0800 Subject: [PATCH] Remove code to strip trailing newlines for backwards compatibility. Based on the comment in the code the justification for the change was because old FlowDelegates used to contain newlines and changing how the returned string from the delegate was handled would be a breaking change. In this case it should be safe to remove the hack because we're breaking compatibility. All users that once implemented FlowDelegate will now need to implement InstalledFlowDelegate and uphold the new contract which implicitly means the authcode returned should represent the authcode and nothing more. No manipulation of the returned string will be done. --- src/installed.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/installed.rs b/src/installed.rs index 701a3b4..a5aec17 100644 --- a/src/installed.rs +++ b/src/installed.rs @@ -127,16 +127,11 @@ impl InstalledFlow { scopes, self.flow_delegate.redirect_uri(), ); - let mut authcode = self + let authcode = self .flow_delegate .present_user_url(&url, true /* need code */) .await .map_err(Error::UserError)?; - // Partial backwards compatibility in case an implementation adds a new line - // due to previous behaviour. - if authcode.ends_with('\n') { - authcode.pop(); - } self.exchange_auth_code(&authcode, hyper_client, app_secret, None) .await }