Merge pull request #20173 from edx/azarembok/fix-video-rewrite-2
PROD-101: Do not rewrite URL for videos that do not have a video id.
This commit is contained in:
@@ -285,10 +285,11 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
|
||||
if getattr(self, 'video_speed_optimizations', True) and cdn_url:
|
||||
branding_info = BrandingInfoConfig.get_config().get(self.system.user_location)
|
||||
|
||||
for index, source_url in enumerate(sources):
|
||||
new_url = rewrite_video_url(cdn_url, source_url)
|
||||
if new_url:
|
||||
sources[index] = new_url
|
||||
if self.edx_video_id and edxval_api:
|
||||
for index, source_url in enumerate(sources):
|
||||
new_url = rewrite_video_url(cdn_url, source_url)
|
||||
if new_url:
|
||||
sources[index] = new_url
|
||||
|
||||
# If there was no edx_video_id, or if there was no download specified
|
||||
# for it, we fall back on whatever we find in the VideoDescriptor
|
||||
|
||||
@@ -842,9 +842,9 @@ class TestGetHtmlMethod(BaseTestXmodule):
|
||||
},
|
||||
}
|
||||
|
||||
# test with and without edx_video_id specified.
|
||||
# Only videos with a video id should have their URLs rewritten
|
||||
# based on CDN settings
|
||||
cases = [
|
||||
dict(case_data, edx_video_id=""),
|
||||
dict(case_data, edx_video_id="vid-v1:12345"),
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user