Skip to content

Commit 83384f0

Browse files
authored
fix: add utf-8 encoding for user fields (#477)
1 parent 2efe2bb commit 83384f0

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

CHANGELOG.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ Please See the `releases tab <https://github.com/openedx/xblock-lti-consumer/rel
1616
Unreleased
1717
~~~~~~~~~~
1818

19+
9.11.1 - 2024-04-24
20+
-------------------
21+
* Add utf-8 encoding for user full name
22+
1923
9.11.0 - 2024-04-24
2024
-------------------
2125
* Remove lxml pin
2226

23-
2427
9.10.0 - 2024-02-29
2528
------------------
2629
* Remove Transifex calls and bundled translation files for the OEP-58 proposal.

lti_consumer/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
from .apps import LTIConsumerApp
55
from .lti_xblock import LtiConsumerXBlock
66

7-
__version__ = '9.11.0'
7+
__version__ = '9.11.1'

lti_consumer/lti_xblock.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ def extract_real_user_data(self):
11301130
user_data = {
11311131
'user_email': None,
11321132
'user_username': None,
1133-
'user_full_name': user.full_name,
1133+
'user_full_name': user.full_name.encode(),
11341134
'user_language': None,
11351135
}
11361136

lti_consumer/tests/unit/test_lti_xblock.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,8 @@ def setUp(self):
957957
fake_user_email = '[email protected]'
958958
fake_user.emails = [fake_user_email]
959959

960-
full_name_mock = PropertyMock(return_value='fake_full_name')
960+
fake_name = 'fáke fǔll ñamë'
961+
full_name_mock = PropertyMock(return_value=fake_name)
961962
type(fake_user).full_name = full_name_mock
962963

963964
fake_username = 'fake'
@@ -1077,7 +1078,7 @@ def test_lti_launch_pii_sharing(
10771078

10781079
set_user_data_kwargs['person_sourcedid'] = 'fake' if pii_sharing_enabled and ask_to_send_username else None
10791080
set_user_data_kwargs['person_name_full'] = (
1080-
'fake_full_name' if pii_sharing_enabled and ask_to_send_full_name else None
1081+
'fáke fǔll ñamë'.encode() if pii_sharing_enabled and ask_to_send_full_name else None
10811082
)
10821083
set_user_data_kwargs['person_contact_email_primary'] = (
10831084
'[email protected]' if pii_sharing_enabled and ask_to_send_email else None
@@ -1814,7 +1815,7 @@ def test_get_lti_1p3_launch_data(
18141815
fake_user_email = '[email protected]'
18151816
fake_username = 'fake_username'
18161817

1817-
fake_name = 'fake_full_name'
1818+
fake_name = 'fáke fǔll ñamë'
18181819
full_name_mock = PropertyMock(return_value=fake_name)
18191820
type(fake_user).full_name = full_name_mock
18201821

@@ -1866,7 +1867,7 @@ def test_get_lti_1p3_launch_data(
18661867
expected_launch_data_kwargs["preferred_username"] = fake_username
18671868

18681869
if ask_to_send_full_name:
1869-
expected_launch_data_kwargs["name"] = fake_name
1870+
expected_launch_data_kwargs["name"] = fake_name.encode()
18701871

18711872
if ask_to_send_email:
18721873
expected_launch_data_kwargs["email"] = fake_user_email

0 commit comments

Comments
 (0)