Removed file exist check in old Paperclip-style
This commit is contained in:
parent
957855de50
commit
456d9df8c0
1 changed files with 4 additions and 8 deletions
|
|
@ -170,10 +170,8 @@ class PackagesController < ApplicationController
|
|||
# If the package is found but has no screenshots then it also returns a
|
||||
# dummy image along with status 404.
|
||||
def thumbnail
|
||||
# TODO: redirect to static thumbnail image URL
|
||||
@package = Package.find_by(name: params[:name])
|
||||
unless @package
|
||||
#logger.debug "Thumbnail for package '#{params[:name]}' requested. No such package found."
|
||||
thumbnail404
|
||||
return
|
||||
end
|
||||
|
|
@ -188,9 +186,7 @@ class PackagesController < ApplicationController
|
|||
|
||||
# Return a 404 if the package has no screenshots or the image was not found
|
||||
thumbnail_path = @screenshot.image.path(:large)
|
||||
unless @screenshot and @screenshot.image.path
|
||||
# Rails.logger.info "- #{screenshot.id} (package: #{screenshot.package.name}) (path: #{path})"
|
||||
#logger.debug "Thumbnail for package '#{params[:name]}' requested. No screenshot or file not found."
|
||||
unless @screenshot
|
||||
thumbnail404
|
||||
return
|
||||
end
|
||||
|
|
@ -209,16 +205,16 @@ class PackagesController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
# Called as /thumbnail-with-version/:name/:version
|
||||
# Called as /screenshot-with-version/:name/:version
|
||||
if params[:version]
|
||||
@screenshot = @package.best_screenshot_for_version(params[:version])
|
||||
# Called as /thumbnail/:name
|
||||
# Called as /screenshot/:name
|
||||
else
|
||||
@screenshot = @package.screenshots.first
|
||||
end
|
||||
|
||||
# Return a 404 if the package has no screenshots or the image was not found
|
||||
unless @screenshot and @screenshot.image.path
|
||||
unless @screenshot
|
||||
screenshot404
|
||||
return
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue