Fix 404 for missing package
This commit is contained in:
parent
9a91229336
commit
3f0737c614
2 changed files with 10 additions and 9 deletions
|
|
@ -19,16 +19,17 @@ class PackagesController < ApplicationController
|
|||
# TODO: Get only screenshots visible to the user (admin or owner or approved)
|
||||
@package = Package.find_by(name: params[:name])
|
||||
|
||||
unless @package
|
||||
if @package.nil?
|
||||
@packagename = params[:name]
|
||||
render 'notfound'
|
||||
end
|
||||
render 'notfound', status: 404
|
||||
else
|
||||
|
||||
# The first page of screenshots (if there are multiple at all) shows the
|
||||
# first image twice as large. So the first page contains 5 images while
|
||||
# the second and further page contain 6 images.
|
||||
@page = params[:page]
|
||||
@screenshots = screenshots_visible_to_user(@package).paginate(page: @page, per_page: 6)
|
||||
# The first page of screenshots (if there are multiple at all) shows the
|
||||
# first image twice as large. So the first page contains 5 images while
|
||||
# the second and further page contain 6 images.
|
||||
@page = params[:page]
|
||||
@screenshots = screenshots_visible_to_user(@package).paginate(page: @page, per_page: 6)
|
||||
end
|
||||
end
|
||||
|
||||
# Show upload form for new images
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue