From 96a8d1862e5d5206a9bfd5c1cdfc05470fcb4558 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Mon, 24 Feb 2020 10:53:48 +0530 Subject: [PATCH] FIX: limit maximum number of CSV rows correctly. bbea8884db9a6ebfc9d651305cd301aba7c0a329 --- plugin.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugin.rb b/plugin.rb index 5623a79..df5b5a4 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1180,10 +1180,16 @@ SQL opts[:explain] = true if params[:explain] == "true" opts[:limit] = - if params[:limit] + if params[:format] == "csv" + if params[:limit].present? + limit = params[:limit].to_i + limit = DataExplorer::QUERY_RESULT_MAX_LIMIT if limit > DataExplorer::QUERY_RESULT_MAX_LIMIT + limit + else + DataExplorer::QUERY_RESULT_MAX_LIMIT + end + elsif params[:limit].present? params[:limit] == "ALL" ? "ALL" : params[:limit].to_i - elsif params[:format] == "csv" - DataExplorer::QUERY_RESULT_MAX_LIMIT end result = DataExplorer.run_query(query, query_params, opts)