From d258e434fcc44a80fe85ba8176e157866a372349 Mon Sep 17 00:00:00 2001 From: Squirrel18 Date: Thu, 17 Oct 2024 16:51:23 -0500 Subject: [PATCH] fix: remove leading or trailing spaces in lti launch parameters. --- lti_consumer/lti_1p1/consumer.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lti_consumer/lti_1p1/consumer.py b/lti_consumer/lti_1p1/consumer.py index 5b2d16d4..7904bcb9 100644 --- a/lti_consumer/lti_1p1/consumer.py +++ b/lti_consumer/lti_1p1/consumer.py @@ -308,6 +308,15 @@ def generate_launch_request(self, resource_link_id): 'Content-Type': 'application/x-www-form-urlencoded', } + # This block removes any leading or trailing spaces in lti parameters. + # We are currently experiencing a launch issue with the Measure UP LTI integration (MUP) + # due to some courses having leading or trailing spaces in their names. + # We decided to handle this from our side to avoid launch request issues + # and due to lack of coordination and communication with the MUP team to fix this from their side. + for lti_parameter, lti_parameter_value in lti_parameters.items(): + if isinstance(lti_parameter_value, str): + lti_parameters[lti_parameter] = lti_parameter_value.strip() + oauth_signature = get_oauth_request_signature( self.oauth_key, self.oauth_secret,