Parcourir la 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 il y a 3 ans
Parent
commit
c07f5830aa
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  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);
 
         // Encoding is needed to support folder names with some special