Sfoglia il codice sorgente

fileeditable filename with accent bug fix

bach 1 mese fa
parent
commit
984ec07084
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      src/components/editable/FileEditable.vue

+ 4 - 1
src/components/editable/FileEditable.vue

@@ -51,11 +51,14 @@ export default {
       this.saveNewFile(file);
     },
     saveNewFile(file){
+      const filename = file.name.normalize('NFD').replace(/[\u0300-\u036f]/g, "").replace(/[^a-zA-Z0-9_\-\.]/g, "_");  // Normalisation Unicode et suppression des accents
+      console.log('filename', filename);
+      
       const configs = {
         headers: {
           'X-CSRF-Token': this.csrf_token,
           'Content-Type': 'application/octet-stream',
-          'Content-Disposition': `file; filename="${file.name}"`,
+          'Content-Disposition': `file; filename="${filename}"`,
         },
       };