Skip to content

Commit 774f3b3

Browse files
authored
fix: Issue when migrating legacy libraries with large keys (#37520)
The length of `purpose` in `StagedContent` is 64. The previous code used the legacy content key. So if the library had a very long key, an error occurred. The new code uses the `pk` instead of the `key`
1 parent 4afff6e commit 774f3b3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • cms/djangoapps/modulestore_migrator

cms/djangoapps/modulestore_migrator/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ def migrate_from_modulestore(
580580
staged_content = staging_api.stage_xblock_temporarily(
581581
block=legacy_root,
582582
user_id=status.user.pk,
583-
purpose=CONTENT_STAGING_PURPOSE_TEMPLATE.format(source_key=source_data.source.key),
583+
purpose=CONTENT_STAGING_PURPOSE_TEMPLATE.format(source_key=source_pk),
584584
)
585585
migration.staged_content = staged_content
586586
status.increment_completed_steps()
@@ -773,7 +773,7 @@ def bulk_migrate_from_modulestore(
773773
staged_content = staging_api.stage_xblock_temporarily(
774774
block=legacy_root_list[i],
775775
user_id=status.user.pk,
776-
purpose=CONTENT_STAGING_PURPOSE_TEMPLATE.format(source_key=source_data.source.key),
776+
purpose=CONTENT_STAGING_PURPOSE_TEMPLATE.format(source_key=source_pk),
777777
)
778778
source_data.migration.staged_content = staged_content
779779
status.increment_completed_steps()

0 commit comments

Comments
 (0)