Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-63239

Exporting search results does not respect jira.search.stable.max.results and exports all results

    XMLWordPrintable

Details

    Description

      Summary

      When exporting JIRA's issues by the search results (Issues > Search for Issues), the application will export everything. By standard, this should not allow you to export more than 1000 issues (JIRA Administration > System > General Configuration > Advanced > jira.search.stable.max.results). Adding this flag (jira.search.views.default.max=1000) to jira-config.properties in JIRA's Home is ignored by the application

      Steps to Reproduce

      On JIRA 7.2.x
      1. Ensure to have more than 1000 issues in your instance
      2. Access the issue navigator and search for all of them
      3. Export these issues to Excel/CSV

      Expected Behavior

      The application should not export more than 1000 issues or the set value from jira.search.stable.max.results.

      Actual Behavior

      All the issues are exported
      Please also note: for large JIRA instances, due to large export this can trigger another problem - JRASERVER-66555

      Workaround

      Temporary
      1. Click on export > Right click on Copy link address
      2. Paste the URL into the URL bar of a new browser tab.
      3. Change the tempMax parameter to the number of issues you want as the example below:

      In the example ahead, I'm exporting the first 50 issue to excel (all fields) for the project "My"

      Definitive

      Add URL re-write rules to the front-end reverse-proxy:

      • For exports of search results (JQL queries):
        1. Match the below patterns:
          /sr/jira.issueviews:searchrequest-excel-current-fields/temp/SearchRequest.xls?jqlQuery=
          /sr/jira.issueviews:searchrequest-csv-current-fields/temp/SearchRequest.csv?jqlQuery=
          
        1. Re-write the URL to add the following to the end:
          &tempMax=1000
          
      • For exports of saved filters:
        1. Match the below patterns:
          /sr/jira.issueviews:searchrequest-excel-current-fields/<filter-id>/SearchRequest-<filter-id>.xls
          /sr/jira.issueviews:searchrequest-csv-current-fields/<filter-id>/SearchRequest-<filter-id>.csv
          

          Note that <filter-id> can be any numeric value starting from 10000.

        1. Re-write the URL to add the following to the end:
          ?tempMax=1000
          
      Definitive - Only Blocks Users from Exporting if &tempMax=value is not Manually Added to the URL

      Please understand this has not been thoroughly tested, we recommend validating the changes on a staging environment before applying into production.

      1. Under <JIRA_INSTALL>/atlassian-jira/WEB-INF/classes/system-issueviews-plugin.xml, look for the below lines;
        <search-request-view key="searchrequest-excel-all-fields" i18n-name-key="admin.issue.views.searchrequest.plugin.excel.all.html" name="Excel" class="com.atlassian.jira.issue.views.SearchRequestExcelViewAllFields" state='enabled' fileExtension="xls" contentType="application/vnd.ms-excel" excludeFromLimitFilter="true">
        
        <search-request-view key="searchrequest-excel-current-fields" i18n-name-key="admin.issue.views.searchrequest.plugin.excel.current.html" name="Excel" class="com.atlassian.jira.issue.views.SearchRequestExcelViewCurrentFields" state='enabled' fileExtension="xls" contentType="application/vnd.ms-excel" excludeFromLimitFilter="true">
        
        <search-request-view key="searchrequest-csv-all-fields" i18n-name-key="admin.issue.views.searchrequest.plugin.csv.all" name="Excel" class="com.atlassian.jira.issue.views.csv.SearchRequestCsvViewAllFields" state='enabled' fileExtension="csv" contentType="text/csv" excludeFromLimitFilter="true">
        
        <search-request-view key="searchrequest-csv-current-fields" i18n-name-key="admin.issue.views.searchrequest.plugin.csv.current" name="Excel" class="com.atlassian.jira.issue.views.csv.SearchRequestCsvViewCurrentFields" state='enabled' fileExtension="csv" contentType="text/csv"  excludeFromLimitFilter="true">
        
        <search-request-view key="searchrequest-charts-view" i18n-name-key="admin.issue.views.plugin.chart.portlet.searchrequestview" name="Charts" class="com.atlassian.jira.issue.views.SearchRequestChartsView" state='enabled' fileExtension="html" contentType="text/html" excludeFromLimitFilter="true">
        
      1. Backup the original file;
      2. Edit the file, removing excludeFromLimitFilter="true" in all of the above lines;
      3. Restart JIRA;

      This workaround does prevent users from exporting issues beyond the limit, but user will see a screen with random characters when attempting to do so (see attached image)

      Attachments

        1. export.png
          1.67 MB
          Tzu Hau Chai

        Issue Links

          Activity

            People

              apawelczyk Artur Pawelczyk (Inactive)
              pahennig Paulo Hennig (Inactive)
              Votes:
              32 Vote for this issue
              Watchers:
              64 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: