diff --git a/openedx_learning/apps/authoring/components/api.py b/openedx_learning/apps/authoring/components/api.py index 477d5f35..3be562a8 100644 --- a/openedx_learning/apps/authoring/components/api.py +++ b/openedx_learning/apps/authoring/components/api.py @@ -594,10 +594,9 @@ def _error_header(error: AssetError) -> dict[str, str]: # At this point, we know that there is valid Content that we want to send. # This adds Content-level headers, like the hash/etag and content type. info_headers.update(contents_api.get_content_info_headers(content)) - stored_file_path = content.file_path() # Recompute redirect headers (reminder: this should never be cached). - redirect_headers = contents_api.get_redirect_headers(stored_file_path, public) + redirect_headers = contents_api.get_redirect_headers(content.path, public) logger.info( "Asset redirect (uncached metadata): " f"{component_version_uuid}/{asset_path} -> {redirect_headers}" diff --git a/tests/openedx_learning/apps/authoring/components/test_api.py b/tests/openedx_learning/apps/authoring/components/test_api.py index e5b53017..1fd8f494 100644 --- a/tests/openedx_learning/apps/authoring/components/test_api.py +++ b/tests/openedx_learning/apps/authoring/components/test_api.py @@ -409,7 +409,6 @@ def test_add(self): new_version.contents.get(componentversioncontent__key="nested/path/hello.txt") ) - def test_multiple_versions(self): hello_content = contents_api.get_or_create_text_content( self.learning_package.id, diff --git a/tests/openedx_learning/apps/authoring/components/test_assets.py b/tests/openedx_learning/apps/authoring/components/test_assets.py index 6d631738..56bfda41 100644 --- a/tests/openedx_learning/apps/authoring/components/test_assets.py +++ b/tests/openedx_learning/apps/authoring/components/test_assets.py @@ -167,7 +167,7 @@ def _assert_html_content_headers(self, response): assert response.status_code == 200 assert response.headers["Etag"] == self.html_asset_content.hash_digest assert response.headers["Content-Type"] == "text/html" - assert response.headers["X-Accel-Redirect"] == self.html_asset_content.file_path() + assert response.headers["X-Accel-Redirect"] == self.html_asset_content.path assert "X-Open-edX-Error" not in response.headers def test_public_asset_response(self): diff --git a/tests/openedx_learning/apps/authoring/contents/test_file_storage.py b/tests/openedx_learning/apps/authoring/contents/test_file_storage.py index 3a27bc03..a94b3157 100644 --- a/tests/openedx_learning/apps/authoring/contents/test_file_storage.py +++ b/tests/openedx_learning/apps/authoring/contents/test_file_storage.py @@ -51,10 +51,10 @@ def test_file_path(self): you're updating this test. """ content = self.html_content - assert content.file_path() == f"content/{content.learning_package.uuid}/{content.hash_digest}" + assert content.path == f"content/{content.learning_package.uuid}/{content.hash_digest}" storage_root = settings.OPENEDX_LEARNING['MEDIA']['OPTIONS']['location'] - assert content.os_path() == f"{storage_root}/{content.file_path()}" + assert content.os_path() == f"{storage_root}/{content.path}" def test_read(self): """Make sure we can read the file data back."""