From 456d9df8c0f110395eb07f9750aef9a2e324f302 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Sat, 13 Feb 2021 23:22:16 +0100 Subject: [PATCH] Removed file exist check in old Paperclip-style --- app/controllers/packages_controller.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/controllers/packages_controller.rb b/app/controllers/packages_controller.rb index 9d79774..eb9a493 100644 --- a/app/controllers/packages_controller.rb +++ b/app/controllers/packages_controller.rb @@ -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