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
|
# If the package is found but has no screenshots then it also returns a
|
||||||
# dummy image along with status 404.
|
# dummy image along with status 404.
|
||||||
def thumbnail
|
def thumbnail
|
||||||
# TODO: redirect to static thumbnail image URL
|
|
||||||
@package = Package.find_by(name: params[:name])
|
@package = Package.find_by(name: params[:name])
|
||||||
unless @package
|
unless @package
|
||||||
#logger.debug "Thumbnail for package '#{params[:name]}' requested. No such package found."
|
|
||||||
thumbnail404
|
thumbnail404
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -188,9 +186,7 @@ class PackagesController < ApplicationController
|
||||||
|
|
||||||
# Return a 404 if the package has no screenshots or the image was not found
|
# Return a 404 if the package has no screenshots or the image was not found
|
||||||
thumbnail_path = @screenshot.image.path(:large)
|
thumbnail_path = @screenshot.image.path(:large)
|
||||||
unless @screenshot and @screenshot.image.path
|
unless @screenshot
|
||||||
# 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."
|
|
||||||
thumbnail404
|
thumbnail404
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -209,16 +205,16 @@ class PackagesController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
# Called as /thumbnail-with-version/:name/:version
|
# Called as /screenshot-with-version/:name/:version
|
||||||
if params[:version]
|
if params[:version]
|
||||||
@screenshot = @package.best_screenshot_for_version(params[:version])
|
@screenshot = @package.best_screenshot_for_version(params[:version])
|
||||||
# Called as /thumbnail/:name
|
# Called as /screenshot/:name
|
||||||
else
|
else
|
||||||
@screenshot = @package.screenshots.first
|
@screenshot = @package.screenshots.first
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return a 404 if the package has no screenshots or the image was not found
|
# Return a 404 if the package has no screenshots or the image was not found
|
||||||
unless @screenshot and @screenshot.image.path
|
unless @screenshot
|
||||||
screenshot404
|
screenshot404
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue