diff --git a/app/assets/javascripts/upload.coffee b/app/assets/javascripts/upload.coffee index 3eb804d23..a85faaa43 100644 --- a/app/assets/javascripts/upload.coffee +++ b/app/assets/javascripts/upload.coffee @@ -310,10 +310,12 @@ bulkCorrectionUpload = (fileInput) -> # Disable upload if uploaded (zip)-file is empty # Temporary fix for ":type option required" error in the # app/controllers/submissions_controller.rb -> show_correction - fileSizes = dataAll.map((data) => data.metadata.size) - if fileSizes.includes(0) - console.log('empty file encountered during bulk upload') - alert($('#bulk-uploadButton-button-actual').data('tr-failure-empty-file')) + for data in dataAll + if data.metadata.size > 0 + continue + console.log('empty file encountered during bulk upload: ' + data.metadata.filename) + alert(data.metadata.filename + ' ' + + $('#bulk-uploadButton-button-actual').data('tr-failure-empty-file-bulk')) $('#bulk-uploadButton-button-actual').hide() $(metaData).empty() return diff --git a/app/views/tutorials/_bulk_correction_form.html.erb b/app/views/tutorials/_bulk_correction_form.html.erb index fbdf45e16..7980c387d 100644 --- a/app/views/tutorials/_bulk_correction_form.html.erb +++ b/app/views/tutorials/_bulk_correction_form.html.erb @@ -34,6 +34,7 @@ data-tr-failure="<%= t('submission.upload_failure')%>" data-tr-missing-consent="<%= t('submission.missing_consent')%>" data-tr-failure-empty-file="<%= t('submission.upload_failure_empty_file')%>" + data-tr-failure-empty-file-bulk="<%= t('submission.upload_failure_empty_file_bulk')%>" data-tr-post-processing="<%= t('basics.post_processing')%>" class="btn btn-sm btn-outline-secondary" > diff --git a/config/locales/de.yml b/config/locales/de.yml index 1a693a43f..a378ff103 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -2667,6 +2667,9 @@ de: upload_failure_empty_file: > Die hochgeladene Datei ist leer. Bitte vergewissere dich, dass die Datei nicht beschädigt ist. + upload_failure_empty_file_bulk: > + ist leer. + Bitte vergewissere dich, dass die Datei nicht beschädigt ist. file_size_too_big: Die Datei ist eigentlich zu groß, kann aber hochgeladen werden. file_size_way_too_big: Die Dateigröße überschreitet das Limit. Bitte optimiere sie. optimization_help_html: > diff --git a/config/locales/en.yml b/config/locales/en.yml index b4ef6c4a0..8dbc5f8b4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2514,6 +2514,9 @@ en: upload_failure_empty_file: > The uploaded file is empty. Please make sure that the file is not corrupted. + upload_failure_empty_file_bulk: > + is empty. + Please make sure that the file is not corrupted. file_size_too_big: The filesize exceeds the limit, nevertheless it is uploadable. file_size_way_too_big: The filesize exceeds the limit. Please optimize it. optimization_help_html: >