@nkhang1902/strapi-plugin-export-import-clsx 1.5.5 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -175,9 +175,19 @@ const ExportImportButtons = (props) => {
|
|
|
175
175
|
const a = document.createElement("a");
|
|
176
176
|
a.href = url;
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
let filename = 'download.xlsx';
|
|
179
|
+
|
|
180
|
+
if (disposition) {
|
|
181
|
+
const utf8Match = disposition.match(/filename\*\s*=\s*UTF-8''([^;]+)/i);
|
|
182
|
+
if (utf8Match) {
|
|
183
|
+
filename = decodeURIComponent(utf8Match[1]);
|
|
184
|
+
} else {
|
|
185
|
+
const asciiMatch = disposition.match(/filename\s*=\s*"?([^";]+)"?/i);
|
|
186
|
+
if (asciiMatch) {
|
|
187
|
+
filename = asciiMatch[1];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
181
191
|
|
|
182
192
|
a.download = filename;
|
|
183
193
|
document.body.appendChild(a);
|
|
@@ -79,9 +79,21 @@ const ExportButtonsEditView = (props) => {
|
|
|
79
79
|
const a = document.createElement("a");
|
|
80
80
|
a.href = url;
|
|
81
81
|
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
const disposition = response.headers.get('Content-Disposition');
|
|
83
|
+
|
|
84
|
+
let filename = 'download.xlsx';
|
|
85
|
+
|
|
86
|
+
if (disposition) {
|
|
87
|
+
const utf8Match = disposition.match(/filename\*\s*=\s*UTF-8''([^;]+)/i);
|
|
88
|
+
if (utf8Match) {
|
|
89
|
+
filename = decodeURIComponent(utf8Match[1]);
|
|
90
|
+
} else {
|
|
91
|
+
const asciiMatch = disposition.match(/filename\s*=\s*"?([^";]+)"?/i);
|
|
92
|
+
if (asciiMatch) {
|
|
93
|
+
filename = asciiMatch[1];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
85
97
|
|
|
86
98
|
a.download = filename;
|
|
87
99
|
document.body.appendChild(a);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nkhang1902/strapi-plugin-export-import-clsx",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6",
|
|
4
4
|
"description": "A powerful Strapi plugin for exporting and importing data with Excel support and advanced filtering",
|
|
5
5
|
"main": "./strapi-server.js",
|
|
6
6
|
"scripts": {
|