Skip to content

Commit 887a5c8

Browse files
committed
temp
1 parent 39d3dc8 commit 887a5c8

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • cms/djangoapps/modulestore_migrator

cms/djangoapps/modulestore_migrator/tasks.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)