Skip to content

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

@bradenmacdonald

Description

@bradenmacdonald

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions