https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292021-04-21T05:08:09ZRedmineRedmine - Feature #35137: Reject CSV file without data row when importinghttps://www.redmine.org/issues/35137?journal_id=1021532021-04-21T05:08:09ZYuichi HARADA
<ul><li><strong>File</strong> <a href="/attachments/27233">35137.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/27233/35137.patch">35137.patch</a> added</li></ul><p>I created a patch. You get a message when you try to import a file that has only a header row.</p>
<pre><code class="diff syntaxhl"><span class="gh">diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb
index 721d08fa2..2b9edfc31 100644
</span><span class="gd">--- a/app/controllers/imports_controller.rb
</span><span class="gi">+++ b/app/controllers/imports_controller.rb
</span><span class="p">@@ -50,7 +50,11 @@</span> class ImportsController < ApplicationController
def settings
if request.post? && @import.parse_file
<span class="gd">- redirect_to import_mapping_path(@import)
</span><span class="gi">+ if @import.total_items == 0
+ flash.now[:error] = l(:error_no_data_import_file)
+ else
+ redirect_to import_mapping_path(@import)
+ end
</span> end
rescue CSV::MalformedCSVError, EncodingError => e
<span class="gh">diff --git a/config/locales/en.yml b/config/locales/en.yml
index 9d779a2fe..c948d40ff 100644
</span><span class="gd">--- a/config/locales/en.yml
</span><span class="gi">+++ b/config/locales/en.yml
</span><span class="p">@@ -223,6 +223,7 @@</span> en:
error_invalid_file_encoding: "The file is not a valid %{encoding} encoded file"
error_invalid_csv_file_or_settings: "The file is not a CSV file or does not match the settings below (%{value})"
error_can_not_read_import_file: "An error occurred while reading the file to import"
<span class="gi">+ error_no_data_import_file: "There is no data to import into the file"
</span> error_attachment_extension_not_allowed: "Attachment extension %{extension} is not allowed"
error_ldap_bind_credentials: "Invalid LDAP Account/Password"
error_no_tracker_allowed_for_new_issue_in_project: "The project doesn't have any trackers for which you can create an issue"
</code></pre> Redmine - Feature #35137: Reject CSV file without data row when importinghttps://www.redmine.org/issues/35137?journal_id=1026502021-06-03T09:15:27ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/27462">Screenshot_2021-06-03.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/27462/Screenshot_2021-06-03.png">Screenshot_2021-06-03.png</a> added</li><li><strong>Target version</strong> set to <i>Candidate for next major release</i></li></ul><p>Users can run the import after configuring the field mapping, even if the CSV file contains only a header row.</p>
<p>However, after running the import of the CSV file, only a blank page is displayed (see <a class="attachment" href="https://www.redmine.org/attachments/27462">Screenshot_2021-06-03.png</a>). I think it is confusing and difficult to troubleshoot for some users.</p>
<p>I think it would be helpful to display an appropriate error message so as not to confuse users.</p> Redmine - Feature #35137: Reject CSV file without data row when importinghttps://www.redmine.org/issues/35137?journal_id=1026512021-06-03T09:42:25ZGo MAEDA
<ul><li><strong>File</strong> <i>35137-v2.patch</i> added</li><li><strong>Subject</strong> changed from <i>Display a message indicating that there is no data</i> to <i>Reject CSV file without data row when importing</i></li></ul><p>Changed the error message in the patch.</p> Redmine - Feature #35137: Reject CSV file without data row when importinghttps://www.redmine.org/issues/35137?journal_id=1026522021-06-03T09:46:23ZGo MAEDA
<ul><li><strong>File</strong> deleted (<del><i>35137-v2.patch</i></del>)</li></ul> Redmine - Feature #35137: Reject CSV file without data row when importinghttps://www.redmine.org/issues/35137?journal_id=1026532021-06-03T09:46:50ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/27464">35137-v2.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/27464/35137-v2.patch">35137-v2.patch</a> added</li></ul> Redmine - Feature #35137: Reject CSV file without data row when importinghttps://www.redmine.org/issues/35137?journal_id=1026692021-06-04T07:42:59ZGo MAEDA
<ul><li><strong>Target version</strong> changed from <i>Candidate for next major release</i> to <i>5.0.0</i></li></ul><p>Setting the target version to 5.0.0.</p> Redmine - Feature #35137: Reject CSV file without data row when importinghttps://www.redmine.org/issues/35137?journal_id=1028912021-06-20T13:27:18ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Go MAEDA</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul><p>Committed the patch. Thank you.</p>