Browse Source

[frontend] fix to upload files with non ascii names on macos (#2888)

Uploading a file via the web browser on MacOS will use the NFD unicode normalization (decomposed) for the filename which will cause the upload to HDFS to fail.
By normalizing the file name to NFC (composed) before sending it from the client we can avaoid this problem.

Co-authored-by: Björn Alm <balm@cloudera.com>
Bjorn Alm 3 years ago
parent
commit
c07f5830aa
1 changed files with 2 additions and 2 deletions
  1. 2 2
      desktop/core/src/desktop/js/ext/fileuploader.custom.js

+ 2 - 2
desktop/core/src/desktop/js/ext/fileuploader.custom.js

@@ -1256,8 +1256,8 @@ qq.extend(qq.UploadHandlerXhr.prototype, {
             }
             }
         };
         };
 
 
-        var formData = new FormData();
-        formData.append(params.fileFieldLabel, file);
+        var formData = new FormData();        
+        formData.append(params.fileFieldLabel, file, file.name.normalize('NFC'));
         formData.append('dest', params.dest);
         formData.append('dest', params.dest);
 
 
         // Encoding is needed to support folder names with some special 
         // Encoding is needed to support folder names with some special