Explorar o código

[Importer] notifying if file is empty (#2938)

Ayush Goyal %!s(int64=3) %!d(string=hai) anos
pai
achega
bf76d8de7a
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      desktop/libs/indexer/src/indexer/templates/importer.mako

+ 4 - 1
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -3234,7 +3234,10 @@ ${ commonheader(_("Importer"), "indexer", user, request, "60px") | n,unicode }
         var files = $('#inputfile')[0].files[0];
         var files = $('#inputfile')[0].files[0];
         fd.append('file', files);
         fd.append('file', files);
         var file_size = files.size;
         var file_size = files.size;
-        if (file_size > 200 * 1024) {          
+        if (file_size === 0) {
+          $.jHueNotify.warn("${ _('This file is empty, please select another file.') }");
+        }
+        else if (file_size > 200 * 1024) {          
           $.jHueNotify.warn("${ _('File size exceeds the supported size (200 KB). Please use the S3, ABFS or HDFS browser to upload files.') }");
           $.jHueNotify.warn("${ _('File size exceeds the supported size (200 KB). Please use the S3, ABFS or HDFS browser to upload files.') }");
         } else {
         } else {
           $.ajax({
           $.ajax({