Library V2 video transcripts: path stored as static/… and read as static/static/… (download 404, LMS 404, orphan asset on delete)

Đang mở
#39,367 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
django, python
Lĩnh vực
backend, cloud

Hướng nghiên cứu

Start with openedx/core/djangoapps/video_config/services.py around line 231 (upload stores the 'static/' prefixed name) and line 282 (delete), then openedx/core/djangoapps/video_config/transcripts_utils.py around line 1004 (get_transcript_from_openedx_content). Reproduce via the studio_transcript handler on a V2 library video, then decide whether to store the bare filename or strip the prefix in readers. Done when upload, download and delete round-trip with no 404 and no orphaned asset, covered by a library test.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

For a Video in a Content Library V2, an uploaded transcript can't be downloaded, doesn't reach the LMS on a reused copy, and leaves an orphan file on delete. The transcript file path is stored with a static/ prefix, and the readers add static/ again.

Steps to reproduce

Found while smoke-testing openedx/openedx-platform#38750 on a local Tutor nightly (master base 6f85d63c7f, xblocks-core 2.0.0):

  1. Create a Video in a V2 library and upload an .srt through the studio_transcript handler (POST .../handler/studio_transcript/translation with language_code=en, new_language_code=en, file). → 201.
  2. The block's transcripts field is now {"en": "static/transcript-en.srt"}, and the component has asset static/transcript-en.srt.
  3. GET .../studio_transcript/translation?language_code=en → 404.
  4. Publish and reuse the video in a course: the LMS player metadata lists en, but .../handler/transcript/translation/en → 404.
  5. Delete via DELETE .../studio_transcript/translation {"lang": "en", "edx_video_id": ""} → 200. The field is cleared, but the asset static/transcript-en.srt remains.

Cause

  • Upload: openedx/core/djangoapps/video_config/services.py:231 sets filename = f'static/transcript-{new_language_code}.srt' and stores it in video_block.transcripts[lang].
  • Read: openedx/core/djangoapps/video_config/transcripts_utils.py:1004 (get_transcript_from_openedx_content) builds pathlib.Path(f"static/{transcripts[language]}"), giving static/static/transcript-en.srt.
  • Delete: services.py:282 deletes f"static/{transcript_name}", which also doubles the prefix, so the asset is never removed.

The prefix was already stored this way in the built-in video_handlers.py before the logic moved to VideoConfigService (3c9e1a90de), so this predates the XBlock extraction. The get_transcript_from_openedx_content docstring expects the field to hold the bare filename ({"en": "3_yD_cEKoCk-en.srt"}).

Suggested fix

Store the bare filename in transcripts (keep static/ only for the asset path), or strip a leading static/ in the readers and in delete for existing data. Add a library upload → download → delete round-trip test.

| Generated using Claude Code

Ngôn ngữ chính
Python
Star
8.2k
Fork
4.4k
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
40

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openedx/openedx-platform

Tất cả issue của openedx/openedx-platform

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.