Skip to content

Conversation

@Faraz32123
Copy link
Contributor

@Faraz32123 Faraz32123 commented Oct 23, 2025

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.
  • Previous Code link, that caused the issue.

Before:

mfe.before.mov

before.mov

After:

mfe.after.mov

after.mov

- 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.
@ormsbee
Copy link
Contributor

ormsbee commented Oct 23, 2025

Copy-pasting is complicated by the combination of sources and destinations, e.g.:

  • Library -> any Library (since assets have a component-local namespace)
  • Library -> Course (for both the "add to course" workflow as well as the clipboard workflow)
  • Course -> Library
  • Course -> same Course
  • Course -> different Course
  • Library -> Course (asset in contentstore subdirectory) -> same Course (I think it shouldn't actually copy the asset?)
  • Library -> Course -> different Course

This code has shifted around a bit since I last worked with it, so I'm not sure what the state of things is now. Ideally, we would have a canonical normal form for expressing the OLX and its assets, and we would translate based only on the destination. I'm not sure if that's the case.

So my high level question is: Have you double checked the different copy/paste combinations to make sure your change here did not cause any regressions in those?

@bradenmacdonald
Copy link
Contributor

Yes, and the commit which you say caused the issue was designed to fix:

Static assets were not being copied into the course when using library content via Problem Bank or "Add Library Content" workflows.

So in addition to copy-paste, we need to ensure that this change has no regressions to "Add Library Content" (v2), which is a workflow that is related to copy-paste and has some things in common with it, but is different.

@Faraz32123
Copy link
Contributor Author

@ormsbee I have tested all different scenarios. Copy paste has started working with these changes.

I think it shouldn't actually copy the asset?

regarding your above statement,
when we copy any component that has image/asset from library to course and course already have that asset. It still copies it because of different file_path('components_html_html8_sugo_gnocchi.JPG'), 'components_html_html2_sugo_gnocchi.JPG')) for every library.

But yes copy paste has started working.

@ormsbee ormsbee merged commit 8f7e8e3 into master Oct 24, 2025
53 checks passed
@ormsbee ormsbee deleted the fix/copy_paste_component_with_image branch October 24, 2025 15:12
haftamuk pushed a commit to haftamuk/edx-platform that referenced this pull request Nov 3, 2025
- 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 <faraz.maqsood@A006-01130.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants