Return thumbnail or screenshot image upon 404 instead of exception

This commit is contained in:
Christoph Haas 2016-07-15 11:02:38 +02:00
parent a01d2c751c
commit 6a92292e9b

View file

@ -106,7 +106,7 @@ 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
@package = Package.find_by!(name: params[:name])
@package = Package.find_by(name: params[:name])
unless @package
thumbnail404
return
@ -135,7 +135,7 @@ class PackagesController < ApplicationController
# If the package is found but has no screenshots then it also returns a
# dummy image along with status 404.
def screenshot
@package = Package.find_by!(name: params[:name])
@package = Package.find_by(name: params[:name])
unless @package
screenshot404
return