logic made nicer
This commit is contained in:
parent
9de9f93489
commit
19f85a27d6
1 changed files with 13 additions and 7 deletions
|
|
@ -296,15 +296,21 @@ class PackagesController < ApplicationController
|
|||
end
|
||||
|
||||
# Return a 404 if the package has no screenshots or the image was not found
|
||||
unless @image
|
||||
if @image
|
||||
send_file(File.join(@image.simage.storage.directory, @image.simage(size).id),
|
||||
disposition: 'inline')
|
||||
else
|
||||
Rails.logger.debug 'no such image -> 404'
|
||||
screenshot404 if %i[large small].include?(size)
|
||||
thumbnail404 if size == :thumb
|
||||
return
|
||||
case size
|
||||
when :large
|
||||
screenshot404
|
||||
when :small
|
||||
screenshot404
|
||||
when :thumb
|
||||
Rails.logger.debug 'thumb404'
|
||||
thumbnail404
|
||||
end
|
||||
end
|
||||
|
||||
send_file(File.join(@image.simage.storage.directory, @image.simage(size).id),
|
||||
disposition: 'inline')
|
||||
end
|
||||
|
||||
# Receives a form with a simple text field 'description' so that users can update
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue