@nkhang1902/strapi-plugin-export-import-clsx 1.5.5 → 1.5.7

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,21 @@ const ExportImportButtons = (props) => {
175
175
  const a = document.createElement("a");
176
176
  a.href = url;
177
177
 
178
- const filename = response.headers
179
- .get("Content-Disposition")
180
- .split("filename=")[1];
178
+ const disposition = response.headers.get('Content-Disposition');
179
+
180
+ let filename = 'download.xlsx';
181
+
182
+ if (disposition) {
183
+ const utf8Match = disposition.match(/filename\*\s*=\s*UTF-8''([^;]+)/i);
184
+ if (utf8Match) {
185
+ filename = decodeURIComponent(utf8Match[1]);
186
+ } else {
187
+ const asciiMatch = disposition.match(/filename\s*=\s*"?([^";]+)"?/i);
188
+ if (asciiMatch) {
189
+ filename = asciiMatch[1];
190
+ }
191
+ }
192
+ }
181
193
 
182
194
  a.download = filename;
183
195
  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 filename = response.headers
83
- .get("Content-Disposition")
84
- .split("filename=")[1];
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.5",
3
+ "version": "1.5.7",
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": {