uploaded files appear in downloaded eportfolio pages
When an ePortfolio page has an attached image or file, the image or file appears as a seperate file in the .zip download and appears on the page's html file. Because of this, an ePortfolio user will be able to access the file from the html page instead of the filesystem. fixes CNVS-21703 test plan: - Create a new ePortfolio - Click on the default Welcome page and then click on "Edit this page" - Select Image/File Upload from the Add Content menu - Select "choose file," select any image file from your desktop, and then click "Select/Upload File" - Repeat the Image/File upload procedure, this time picking any non-image file. - Click "Save Page" - Return to the ePortfolio main page via the navagation breadcrumbs - Click "Download the contents of this ePortfolio as a zip file" - Unzip the downloaded zip file and observe that the files you uploads are there along with Home_Welcome.html. - Open the "Home_Welcome.html" file in a web browser. - Observe the image inline as a link to the file on disk and the non-image file as a "Click here to Download..." link. - Observe both links work Change-Id: I37fdc47df199733d21de67b7d220f746d54f12b5 Reviewed-on: https://gerrit.instructure.com/60697 Reviewed-by: Cameron Matheson <cameron@instructure.com> Tested-by: Jenkins QA-Review: Jason Carter <jcarter@instructure.com> Product-Review: Josh Simpson <jsimpson@instructure.com>
This commit is contained in:
parent
0a5fea0efe
commit
a5320105ba
|
@ -7,7 +7,7 @@
|
|||
<%= raw(page_section["content"]) || t('rich_text.default_content', "Nothing Entered Yet") %>
|
||||
<% elsif page_section["section_type"] == "attachment" %>
|
||||
<div style="text-align: center;" class="attachment">
|
||||
<% attachment = @static_attachments.find{|a| a.uuid == page_section["attachment_id"]} %>
|
||||
<% attachment = @static_attachments.find{|a| a.id == page_section["attachment_id"]} %>
|
||||
<% if attachment && attachment.content_type.match(/\Aimage/) %>
|
||||
<a href="<%= attachment.filename %>"><img src="<%= attachment.filename %>" alt="<%= attachment.filename %>"/></a>
|
||||
<% elsif attachment %>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<% elsif submission.submission_type = 'online_upload' %>
|
||||
<ul>
|
||||
<% submission.attachments.each do |a| %>
|
||||
<% attachment = @static_attachments.find{|att| att.attachment.id == a.id } %>
|
||||
<% attachment = @static_attachments.find{|att| att.id == a.id } %>
|
||||
<% if attachment %>
|
||||
<li><a href="<%= attachment.filename %>">
|
||||
<%= t('links.download_attachment', "Click here to Download *%{attachment}*",
|
||||
|
|
|
@ -104,6 +104,7 @@ class ContentZipper
|
|||
:filename,
|
||||
:content_type,
|
||||
:uuid,
|
||||
:id,
|
||||
:attachment)
|
||||
|
||||
def zip_eportfolio(zip_attachment, portfolio)
|
||||
|
@ -128,6 +129,7 @@ class ContentZipper
|
|||
obj.filename = "#{idx}_#{a.filename}"
|
||||
obj.content_type = a.content_type
|
||||
obj.uuid = a.uuid
|
||||
obj.id = a.id
|
||||
obj.attachment = a
|
||||
idx += 1
|
||||
obj
|
||||
|
@ -145,7 +147,7 @@ class ContentZipper
|
|||
end
|
||||
update_progress(zip_attachment, idx, count)
|
||||
static_attachments.each do |a|
|
||||
add_attachment_to_zip(a.attachment, zipfile)
|
||||
add_attachment_to_zip(a.attachment, zipfile, a.filename)
|
||||
update_progress(zip_attachment, idx, count)
|
||||
end
|
||||
content = File.open(Rails.root.join('public', 'images', 'logo.png'), 'rb').read rescue nil
|
||||
|
|
Loading…
Reference in New Issue