Defect #44126 » svg-preview-fix.patch
| app/controllers/attachments_controller.rb | ||
|---|---|---|
|
User.current.preference.save
|
||
|
end
|
||
|
render :action => 'diff'
|
||
|
elsif @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte
|
||
|
@content = File.read(@attachment.diskfile, :mode => "rb")
|
||
|
render :action => 'file'
|
||
|
elsif @attachment.is_image?
|
||
|
render :action => 'image'
|
||
|
elsif @attachment.is_pdf?
|
||
|
render :action => 'pdf'
|
||
|
elsif @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte
|
||
|
@content = File.read(@attachment.diskfile, :mode => "rb")
|
||
|
render :action => 'file'
|
||
|
elsif @content = @attachment.markdownized_preview_content
|
||
|
render :action => 'markdownized'
|
||
|
else
|
||
| test/functional/attachments_controller_test.rb | ||
|---|---|---|
|
assert_select 'img.filecontent', :src => attachments(:attachments_010).filename
|
||
|
end
|
||
|
def test_show_svg_file_as_image
|
||
|
set_tmp_attachments_directory
|
||
|
attachment = Attachment.create!(
|
||
|
:container => Issue.find(1),
|
||
|
:file => uploaded_test_file('testfile.svg', 'image/svg+xml'),
|
||
|
:author => User.find(1)
|
||
|
)
|
||
|
get(:show, :params => {:id => attachment.id})
|
||
|
assert_response :success
|
||
|
assert_equal 'text/html', @response.media_type
|
||
|
assert_select 'img.filecontent', :src => attachment.filename
|
||
|
end
|
||
|
def test_show_pdf
|
||
|
@request.session[:user_id] = 2
|
||
|
get(:show, :params => {:id => 23})
|
||
- « Previous
- 1
- 2
- 3
- Next »