Skip to content

Commit

Permalink
fix: add public video share valid course key check (#33260)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinAoki authored Sep 15, 2023
1 parent 202e790 commit e820162
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions xmodule/video_block/video_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ def get_html(self, view=STUDENT_VIEW, context=None): # lint-amnesty, pylint: di
'transcript_download_format': transcript_download_format,
'transcript_download_formats_list': self.fields['transcript_download_format'].values, # lint-amnesty, pylint: disable=unsubscriptable-object
}

if self.is_public_sharing_enabled():
public_video_url = self.get_public_video_url()
template_context['public_sharing_enabled'] = True
Expand Down Expand Up @@ -517,9 +516,12 @@ def is_public_sharing_enabled(self):
"""
Is public sharing enabled for this video?
"""

# Video share feature must be enabled for sharing settings to take effect
feature_enabled = PUBLIC_VIDEO_SHARE.is_enabled(self.location.course_key)
try:
# Video share feature must be enabled for sharing settings to take effect
feature_enabled = PUBLIC_VIDEO_SHARE.is_enabled(self.location.course_key)
except Exception as err: # pylint: disable=broad-except
log.exception(f"Error retrieving course for course ID: {self.location.course_key}")
return False
if not feature_enabled:
return False

Expand Down

0 comments on commit e820162

Please sign in to comment.