vtb-appit 0.0.59 → 0.0.60

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.
@@ -242,28 +242,32 @@ class AppitBaseTransformer {
242
242
 
243
243
  promises.push(new Promise((resolve, reject) => {
244
244
  for(let i = 0; i < media.length; i++) {
245
- const req = https.request(media[i].url, res => {
246
- let chunks = [];
247
- res.on('data', chunk => {
248
- chunks.push(chunk);
249
- })
250
-
251
- res.on('end', () => {
252
- const buffer = Buffer.concat(chunks).toString('base64');
253
- let base64Data = 'data:' + res.headers['content-type'] + ';base64,';
254
- base64Data += buffer;
255
-
256
- let frags = media[i].url.split('/');
257
-
258
- resolve({
259
- title: '',
260
- name: frags[frags.length - 1],
261
- content: base64Data
262
- });
263
- })
264
- });
265
-
266
- req.end();
245
+ try {
246
+ const req = https.request(media[i].url, res => {
247
+ let chunks = [];
248
+ res.on('data', chunk => {
249
+ chunks.push(chunk);
250
+ })
251
+
252
+ res.on('end', () => {
253
+ const buffer = Buffer.concat(chunks).toString('base64');
254
+ let base64Data = 'data:' + res.headers['content-type'] + ';base64,';
255
+ base64Data += buffer;
256
+
257
+ let frags = media[i].url.split('/');
258
+
259
+ resolve({
260
+ title: '',
261
+ name: frags[frags.length - 1],
262
+ content: base64Data
263
+ });
264
+ })
265
+ });
266
+
267
+ req.end();
268
+ } catch(e) {
269
+ resolve({});
270
+ }
267
271
  }
268
272
  }));
269
273
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtb-appit",
3
- "version": "0.0.59",
3
+ "version": "0.0.60",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {