handle missing media_id for flvs in epub export

fixes CNVS-25933

test plan:
- Add an flv to a course and include is as downloadable content for a
  module that is accessible to the user.
- Add a media comment to the body of an assignment (or any content
  type).
- Export the course (module sorting), logged in as a user that has
  rights to see the module & the content featuring the media comment.
- Observe that the ePub export is successful.
- Observe that the flv is included in the associated files zip file.
- Observe that the media comment is visible inline in the exported
  ePub.


Change-Id: I796a20da4380ee759ffb1e4cde194ba65a7e599f
Reviewed-on: https://gerrit.instructure.com/69021
Reviewed-by: Matt Berns <mberns@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: John Corrigan <jcorrigan@instructure.com>
This commit is contained in:
John Corrigan 2015-12-16 09:30:01 -06:00
parent f7018aa83f
commit 79fe35a084
1 changed files with 7 additions and 1 deletions

View File

@ -10,7 +10,13 @@ module CC::Exporter::Epub::Converters
attr_reader :flv_path
def convert!
return flv_path unless mp4_url.present?
begin
return flv_path unless mp4_url.present?
# Maybe a weird exception to catch, but that's what ends up being thrown
# if we pass a media_id that doesn't have a corresponding set of assets.
rescue NoMethodError => e
return flv_path
end
f = File.open(mp4_path, 'wb')
CanvasHttp.get(mp4_url) do |response|