File tree Expand file tree Collapse file tree
cms/djangoapps/modulestore_migrator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -963,16 +963,18 @@ def _migrate_component(
963963 return component .versioning .draft .publishable_entity_version , None
964964
965965 # If component existed and was deleted or we have to replace the current version
966- # Create the new component version for it
967- component_version = libraries_api .set_library_block_olx (target_key , new_olx_str = olx )
966+ paths_to_media_ids = {}
968967 for filename , media_pk in context .content_by_filename .items ():
969968 filename_no_ext , _ = os .path .splitext (filename )
970969 if filename_no_ext not in olx :
971970 continue
972971 new_path = f"static/{ filename } "
973- content_api .create_component_version_media (
974- component_version .pk , media_pk , path = new_path
975- )
972+ paths_to_media_ids [new_path ] = media_pk
973+
974+ # Create the new component version for it
975+ component_version = libraries_api .set_library_block_olx (
976+ target_key , new_olx_str = olx , paths_to_media = paths_to_media_ids ,
977+ )
976978
977979 # Publish the component
978980 libraries_api .publish_component_changes (target_key , context .created_by )
You can’t perform that action at this time.
0 commit comments