flexbiz-server 12.5.22 → 12.5.23
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.
package/package.json
CHANGED
|
@@ -195,21 +195,9 @@ class controllerRPT {
|
|
|
195
195
|
res.setHeader('Content-Disposition', 'attachment; filename="' + rptId + '".xlsx');
|
|
196
196
|
//convert sang buffer nếu data là một object có type ==Buffer
|
|
197
197
|
let data = result;
|
|
198
|
-
|
|
199
|
-
if (Buffer.isBuffer(data)) {
|
|
200
|
-
// OK
|
|
201
|
-
}
|
|
202
|
-
else if (data?.type === 'Buffer' && Array.isArray(data.data)) {
|
|
198
|
+
if (data?.type === 'Buffer' && Array.isArray(data.data)) {
|
|
203
199
|
data = Buffer.from(data.data);
|
|
204
200
|
}
|
|
205
|
-
else if (typeof data === 'string') {
|
|
206
|
-
data = Buffer.from(data, 'base64');
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
console.error("[controllerRPT] Dữ liệu không hợp lệ", typeof(data))
|
|
210
|
-
return res.status(400).send({error:'Dữ liệu không hợp lệ'});
|
|
211
|
-
}
|
|
212
|
-
|
|
213
201
|
res.setHeader('Content-Length', data.length);
|
|
214
202
|
res.end(data);
|
|
215
203
|
break;
|