diff --git a/openedx/features/course_experience/url_helpers.py b/openedx/features/course_experience/url_helpers.py index cdcb0203fc..e1fe4110c6 100644 --- a/openedx/features/course_experience/url_helpers.py +++ b/openedx/features/course_experience/url_helpers.py @@ -12,7 +12,7 @@ from django.http import HttpRequest from django.http.request import QueryDict from django.urls import reverse from opaque_keys.edx.keys import CourseKey, UsageKey -from six.moves.urllib.parse import urlencode, urlparse, urlunparse +from six.moves.urllib.parse import urlencode, urlparse from lms.djangoapps.courseware.toggles import courseware_mfe_is_active from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order @@ -171,9 +171,8 @@ def make_learning_mfe_courseware_url( strings. They're only ever used to concatenate a URL string. `params` is an optional QueryDict object (e.g. request.GET) """ - mfe_link = f'/course/{course_key}' + mfe_link = f'{settings.LEARNING_MICROFRONTEND_URL}/course/{course_key}' get_params = params.copy() if params else None - query_string = '' if preview: if len(get_params.keys()) > 1: @@ -182,7 +181,7 @@ def make_learning_mfe_courseware_url( get_params = None if (unit_key or sequence_key): - mfe_link = f'/preview/course/{course_key}' + mfe_link = f'{settings.LEARNING_MICROFRONTEND_URL}/preview/course/{course_key}' if sequence_key: mfe_link += f'/{sequence_key}' @@ -191,13 +190,9 @@ def make_learning_mfe_courseware_url( mfe_link += f'/{unit_key}' if get_params: - query_string = get_params.urlencode() + mfe_link += f'?{get_params.urlencode()}' - url_parts = list(urlparse(settings.LEARNING_MICROFRONTEND_URL)) - url_parts[2] = mfe_link - url_parts[4] = query_string - - return urlunparse(url_parts) + return mfe_link def get_learning_mfe_home_url(