openedx / openedx/frontend-app-authoring

When copy-pasting components, assets/files appear to be duplicates

Open
#2,745 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
17
Forks
218
Avg merge
9d 20h
Merged PRs (30d)
20

Description

When you paste a component into a course multiple times, each of its files gets copied into the course's "Files & Uploads" with a unique prefix of components/{type}/{original_id}/{filename} (see _import_file_into_course and build_components_import_path which is weirdly in the video code). This gets transformed to components_{type}_{original_id}_{filename}, but only the file name part is visible in the files list, so it looks like there's a lot of duplicates:

Image

Suggested fix: if a static asset is in a subfolder, the subfolder path should be displayed in grey text above the actual filename.

Image

Annoying problem: There is absolutely nothing in the API that indicates the difference between an asset in a subfolder and an asset with underscores in its name, other than the fact that the display_name is much shorted than the full filename part of the various URLs. What's more, if you have an asset like components/problem/problem5da54866/simple-question.js (which has URLs that end in components_problem_problem5da54866_simple-question.js) and you deliberately upload an asset with the same name as the URL part (components_problem_problem5da54866_simple-question.js), you will now see two assets in the list, but they will both have the same URLs and same filename (the display_name of the existing asset will change from simple-question.js to components_problem_problem5da54866_simple-question.js and a second components_problem_problem5da54866_simple-question.js will appear, both actually being the same file).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Files & Uploads UI in frontend-app-authoring and compare its displayed names with the paths produced by _import_file_into_course in cms/djangoapps/contentstore/helpers.py and build_components_import_path in openedx/core/djangoapps/video_config/transcripts_utils.py. Done should show subfolder paths separately from filenames and make assets with indistinguishable displayed names understandable without changing their URLs.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.