From 819588864b0c5bb7b3feb8a9e7b431ab2b354595 Mon Sep 17 00:00:00 2001 From: Ian Ballou Date: Wed, 18 Dec 2024 21:38:59 +0000 Subject: [PATCH] Refs #38072 - select default pagination properly --- .../katello/api/v2/host_bootc_images_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/katello/api/v2/host_bootc_images_controller.rb b/app/controllers/katello/api/v2/host_bootc_images_controller.rb index 14fce25f507..a271fe90dd7 100644 --- a/app/controllers/katello/api/v2/host_bootc_images_controller.rb +++ b/app/controllers/katello/api/v2/host_bootc_images_controller.rb @@ -13,8 +13,8 @@ class Api::V2::HostBootcImagesController < Api::V2::ApiController def bootc_images bootc_image_map = bootc_host_image_map(params[:search]) - page = params[:page].to_i || 1 - per_page = params[:per_page].to_i || Setting[:entries_per_page] + page = params[:page].present? ? params[:page].to_i : 1 + per_page = params[:per_page].present? ? params[:per_page].to_i : Setting[:entries_per_page] paged_images = bootc_image_map.to_a.paginate(page: page, per_page: per_page) results = paged_images.collect { |image| { image_name: image[0], digests: image[1] } } render json: { total: bootc_image_map.size, page: page, per_page: per_page, subtotal: bootc_image_map.size, results: results}