Skip to content

Commit b5a9aef

Browse files
committed
fix: return relative path from to prevent double /authoring prefix in MFE sidebar
1 parent 03920db commit b5a9aef

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

cms/djangoapps/contentstore/rest_api/v1/views/tests/test_course_index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_course_index_response(self):
7777
"language_code": "en",
7878
"lms_link": get_lms_link_for_item(self.course.location),
7979
"mfe_proctored_exam_settings_url": (
80-
f"http://course-authoring-mfe/course/{self.course.id}"
80+
f"/course/{self.course.id}"
8181
"/pages-and-resources/proctoring/settings"
8282
),
8383
"notification_dismiss_url": None,
@@ -128,7 +128,7 @@ def test_course_index_response_with_show_locators(self):
128128
"language_code": "en",
129129
"lms_link": get_lms_link_for_item(self.course.location),
130130
"mfe_proctored_exam_settings_url": (
131-
f"http://course-authoring-mfe/course/{self.course.id}"
131+
f"/course/{self.course.id}"
132132
"/pages-and-resources/proctoring/settings"
133133
),
134134
"notification_dismiss_url": None,

cms/djangoapps/contentstore/utils.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,14 @@ def get_pages_and_resources_url(course_locator):
254254

255255
def get_proctored_exam_settings_url(course_locator) -> str:
256256
"""
257-
Gets course authoring microfrontend URL for links to proctored exam settings page
257+
Gets the relative path for links to proctored exam settings page.
258+
Returns a path without the MFE base URL, since React Router prepends the base path.
258259
"""
259-
proctored_exam_settings_url = ''
260260
if exam_setting_view_enabled(course_locator):
261261
mfe_base_url = get_course_authoring_url(course_locator)
262-
course_mfe_url = f'{mfe_base_url}/course/{course_locator}'
263262
if mfe_base_url:
264-
proctored_exam_settings_url = f'{course_mfe_url}/pages-and-resources/proctoring/settings'
265-
return proctored_exam_settings_url
263+
return f'/course/{course_locator}/pages-and-resources/proctoring/settings'
264+
return ''
266265

267266

268267
def get_editor_page_base_url(course_locator) -> str:

0 commit comments

Comments
 (0)