From 8f7e8e3a8b3648a2c228bbc99811b2d46c5a8fd5 Mon Sep 17 00:00:00 2001 From: Muhammad Faraz Maqsood Date: Fri, 24 Oct 2025 20:12:45 +0500 Subject: [PATCH] fix: pasting a component with image isn't working (#37529) - when copying a component that has image in it, and we try to paste it. Image URL appends `static_None`. Result in crash or image not found error. - In this commit we have fixed this scenario, copy paste is working for components containing images. --------- Co-authored-by: Muhammad Faraz Maqsood --- cms/djangoapps/contentstore/helpers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cms/djangoapps/contentstore/helpers.py b/cms/djangoapps/contentstore/helpers.py index 2bdbabc7df..91236a4dad 100644 --- a/cms/djangoapps/contentstore/helpers.py +++ b/cms/djangoapps/contentstore/helpers.py @@ -745,10 +745,10 @@ def _import_file_into_course( if thumbnail_content is not None: content.thumbnail_location = thumbnail_location contentstore().save(content) - return True, {clipboard_file_path: f"static/{import_path}"} + return True, {clipboard_file_path: filename if not import_path else f"static/{import_path}"} elif current_file.content_digest == file_data_obj.md5_hash: - # The file already exists and matches exactly, so no action is needed except substitutions - return None, {clipboard_file_path: f"static/{import_path}"} + # The file already exists and matches exactly, so no action is needed + return None, {} else: # There is a conflict with some other file that has the same name. return False, {}