Fix mime-type lookup.
authorTom Clegg <tom@curoverse.com>
Mon, 6 Jan 2014 23:04:50 +0000 (15:04 -0800)
committerTim Pierce <twp@curoverse.com>
Thu, 9 Jan 2014 23:16:31 +0000 (18:16 -0500)
refs #1813

apps/workbench/app/views/user_agreements/index.html.erb

index 6cad4236f06b7d2f826ddca07bc916d8a5594daf..53a37a2006458172870e2a23d92b517da65ac280 100644 (file)
@@ -23,7 +23,7 @@
   <div class="modal-body">
     <% if n_files == 1 %>
       <% ua = @required_user_agreements.first; file = ua.files.first %>
-      <object data="<%= url_for(controller: 'collections', action: 'show_file', uuid: ua.uuid, file: "#{file[0]}/#{file[1]}") %>" type="<%= Rack::Mime::MIME_TYPES[file[1]] || 'application/pdf' %>" width="100%" height="400px">
+      <object data="<%= url_for(controller: 'collections', action: 'show_file', uuid: ua.uuid, file: "#{file[0]}/#{file[1]}") %>" type="<%= Rack::Mime::MIME_TYPES[file[1].match(/\.\w+$/)[0]] rescue '' %>" width="100%" height="400px">
       </object>
     <% end %>
     <div class="alert alert-info">