@xuda.io/drive_module 1.1.1385 → 1.1.1387

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.
Files changed (2) hide show
  1. package/index.mjs +38 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1804,6 +1804,7 @@ const get_drive_doc = async (type, drive_type, app_id, uid, file_path, headers)
1804
1804
  break;
1805
1805
  }
1806
1806
 
1807
+ const validation_ret = file_upload_validator(file_name);
1807
1808
  if (doc_ret.code < 0) {
1808
1809
  if (drive_type === 'studio') {
1809
1810
  const app_id_reference = await _common.get_project_app_id(app_id);
@@ -1823,7 +1824,7 @@ const get_drive_doc = async (type, drive_type, app_id, uid, file_path, headers)
1823
1824
  ip: headers?.['cf-connecting-ip'],
1824
1825
  country: headers?.['cf-ipcountry'],
1825
1826
  file_ext: ext,
1826
- is_archive: _conf.archive_drive_ext.includes(ext) ? true : false,
1827
+ is_archive: validation_ret.valid && validation_ret.category === 'archive' ? true : false,
1827
1828
  drive_type,
1828
1829
  app_id: await _common.get_project_app_id(app_id),
1829
1830
  app_id_reference: await _common.get_project_app_id(app_id, true),
@@ -2488,6 +2489,42 @@ export const file_upload_validator = function (file_name) {
2488
2489
  case 'ear':
2489
2490
  return { valid: true, category: 'archive', mime: 'application/octet-stream' };
2490
2491
 
2492
+ // ==============================
2493
+ // PICTURES & DESIGN
2494
+ // ==============================
2495
+ case 'tiff':
2496
+ case 'tif':
2497
+ return { valid: true, category: 'image', mime: 'image/tiff' };
2498
+ case 'psd':
2499
+ return { valid: true, category: 'image', mime: 'image/vnd.adobe.photoshop' };
2500
+
2501
+ // ==============================
2502
+ // DOCUMENTS & SPREADSHEETS
2503
+ // ==============================
2504
+ case 'xls':
2505
+ return { valid: true, category: 'document', mime: 'application/vnd.ms-excel' };
2506
+ case 'xlsx':
2507
+ case 'xslx': // Handling common typo
2508
+ return { valid: true, category: 'document', mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' };
2509
+
2510
+ // ==============================
2511
+ // FONTS
2512
+ // ==============================
2513
+ case 'ttf':
2514
+ return { valid: true, category: 'font', mime: 'font/ttf' };
2515
+ case 'otf':
2516
+ return { valid: true, category: 'font', mime: 'font/otf' };
2517
+ case 'woff':
2518
+ return { valid: true, category: 'font', mime: 'font/woff' };
2519
+ case 'woff2':
2520
+ return { valid: true, category: 'font', mime: 'font/woff2' };
2521
+
2522
+ // ==============================
2523
+ // SYSTEM & CONFIG
2524
+ // ==============================
2525
+ case 'plist':
2526
+ return { valid: true, category: 'text', mime: 'application/x-plist' };
2527
+
2491
2528
  // ==============================
2492
2529
  // DEFAULT (INVALID)
2493
2530
  // ==============================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.1385",
3
+ "version": "1.1.1387",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {