This is not ideal, long queries can cause broken links and is a very messy link. report/guided_reports.pl line 816: my $sql = $input->param('sql'); # FIXME: use sql from saved report ID#, not new user-supplied SQL! We use execute_query, so input is sanitized but links look awful http://localhost:8081/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&format=csv&sql=SELECT%20*%20FROM%20message_queue%20ORDER%20BY%20time_queued%20DESC%0D%0A&reportname=Messages
Created attachment 65338 [details] SQL which generates error
Created attachment 65339 [details] Resultant URI
A report with a very long query cannot be downloaded as CSV, giving the error 'Request-URI Too Long'. I'm escalating the priority to normal because this is no longer simply a cosmetic issue; it affects the operation of koha itself. See the attached sql and uri files. To replicate: 1) Paste the contents of the attached 'bug-18497-sql.sql' into a report. 2) Save and run the report 3) On the report page, click Download and select 'Comma separated text' 4) The resulting URI is as contained in 'bug-18497-uri.txt' (adjusting for server name), and gives the error message Request-URI Too Long The requested URL's length exceeds the capacity limit for this server. Apache/2.4.10 (Debian) Server at catalog.bywatersolutions.com Port 443
Created attachment 70245 [details] [review] Bug 18947 - Use report id to retrieve saved SQL instead of passing param This patch takes some of the code when executing report and moves it to a sub to be reused when downloading To test: 1 - Run some very long report (see comment #1) 2 - Try to download, erk! 3 - Apply patch 4 - Run report, results hould not have changed 5 - Try to download, success! 6 - Ensure reports work as before
*** Bug 19803 has been marked as a duplicate of this bug. ***
Created attachment 70637 [details] Sample SQL query to trigger bug. Revised query that works with master and default data
Created attachment 70639 [details] [review] Bug 18497 - Use report id to retrieve saved SQL instead of passing param This patch takes some of the code when executing report and moves it to a sub to be reused when downloading To test: 1 - Run some very long report (see comment #1) 2 - Try to download, erk! 3 - Apply patch 4 - Run report, results hould not have changed 5 - Try to download, success! 6 - Ensure reports work as before https://bugs.koha-community.org/show_bug.cgi?id=18497 Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
This works, but it generates new HTML validation errors: > Error: Bad value > /cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&format=csv&report_id=2&reportname=Test↩ &sql_params=foo↩ > for attribute href on element a: Tab, new line or carriage return found. Please fix this. Also, please fix the commit message: - "Bug XXXXX -" should be "Bug XXXXX:" according to https://wiki.koha-community.org/wiki/Commit_messages - Bug's URL should be removed (it's wrong)
Created attachment 71060 [details] [review] Bug 18497: Use report id to retrieve saved SQL instead of passing param This patch takes some of the code when executing report and moves it to a sub to be reused when downloading To test: 1 - Run some very long report (see comment #1) 2 - Try to download, erk! 3 - Apply patch 4 - Run report, results hould not have changed 5 - Try to download, success! 6 - Ensure reports work as before Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Created attachment 71061 [details] [review] Bug 18497: (follow-up) Chomp newlines in BLOCK To test: Run report Validate results page at: https://validator.w3.org/
Created attachment 71080 [details] [review] Bug 18497: Use report id to retrieve saved SQL instead of passing param This patch takes some of the code when executing report and moves it to a sub to be reused when downloading To test: 1 - Run some very long report (see comment #1) 2 - Try to download, erk! 3 - Apply patch 4 - Run report, results hould not have changed 5 - Try to download, success! 6 - Ensure reports work as before Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Created attachment 71081 [details] [review] Bug 18497: (follow-up) Chomp newlines in BLOCK To test: Run report Validate results page at: https://validator.w3.org/ Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Pushed to master for 18.05, thanks to everybody involved!
Awesome work all, pushed to stable for 17.11.03