Feature #35137
closedReject CSV file without data row when importing
Added by Yuichi HARADA over 3 years ago. Updated over 3 years ago.
0%
Description
It is suggested to display a message indicating that there is no data when trying to import a file that has no data.
Files
message-no-data.png (88.1 KB) message-no-data.png | Yuichi HARADA, 2021-04-21 06:38 | ||
35137.patch (2.95 KB) 35137.patch | Yuichi HARADA, 2021-04-21 07:06 | ||
Screenshot_2021-06-03.png (57.6 KB) Screenshot_2021-06-03.png | Go MAEDA, 2021-06-03 11:14 | ||
35137-v2.patch (2.91 KB) 35137-v2.patch | Go MAEDA, 2021-06-03 11:46 |
Updated by Yuichi HARADA over 3 years ago
- File 35137.patch 35137.patch added
I created a patch. You get a message when you try to import a file that has only a header row.
diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb
index 721d08fa2..2b9edfc31 100644
--- a/app/controllers/imports_controller.rb
+++ b/app/controllers/imports_controller.rb
@@ -50,7 +50,11 @@ class ImportsController < ApplicationController
def settings
if request.post? && @import.parse_file
- redirect_to import_mapping_path(@import)
+ if @import.total_items == 0
+ flash.now[:error] = l(:error_no_data_import_file)
+ else
+ redirect_to import_mapping_path(@import)
+ end
end
rescue CSV::MalformedCSVError, EncodingError => e
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 9d779a2fe..c948d40ff 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -223,6 +223,7 @@ 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"
+ error_no_data_import_file: "There is no data to import into the file"
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"
Updated by Go MAEDA over 3 years ago
- File Screenshot_2021-06-03.png Screenshot_2021-06-03.png added
- Target version set to Candidate for next major release
Users can run the import after configuring the field mapping, even if the CSV file contains only a header row.
However, after running the import of the CSV file, only a blank page is displayed (see Screenshot_2021-06-03.png). I think it is confusing and difficult to troubleshoot for some users.
I think it would be helpful to display an appropriate error message so as not to confuse users.
Updated by Go MAEDA over 3 years ago
- File 35137-v2.patch added
- Subject changed from Display a message indicating that there is no data to Reject CSV file without data row when importing
Changed the error message in the patch.
Updated by Go MAEDA over 3 years ago
- Target version changed from Candidate for next major release to 5.0.0
Setting the target version to 5.0.0.
Updated by Go MAEDA over 3 years ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch. Thank you.