@xuda.io/drive_module 1.1.1381 → 1.1.1383

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 +6 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -995,6 +995,8 @@ export const extract_drive_file = async (req, job_id, headers) => {
995
995
  entry.pipe(fs.createWriteStream(extract_path));
996
996
  }
997
997
 
998
+ const validation_ret = file_upload_validator(fileName);
999
+
998
1000
  let file_doc = {
999
1001
  _id: file_doc_id,
1000
1002
 
@@ -1010,7 +1012,7 @@ export const extract_drive_file = async (req, job_id, headers) => {
1010
1012
  ip: headers['cf-connecting-ip'],
1011
1013
  country: headers['cf-ipcountry'],
1012
1014
  file_ext: ext,
1013
- is_archive: _conf.archive_drive_ext.includes(ext) ? true : false,
1015
+ is_archive: validation_ret.valid && validation_ret.category === 'archive' ? true : false,
1014
1016
  size,
1015
1017
  };
1016
1018
  if (type === 'Directory') {
@@ -1078,7 +1080,9 @@ export const upload_drive_file = async (req, job_id, headers, file_obj) => {
1078
1080
  let originalname = path.basename(file_obj.originalname);
1079
1081
  const tempPath = file_obj.path;
1080
1082
 
1081
- if (![..._conf.allowedExts_drive, ..._conf.archive_drive_ext].includes(ext)) {
1083
+ const validation_ret = file_upload_validator(file_obj.originalname);
1084
+
1085
+ if (!validation_ret.valid) {
1082
1086
  await fs_module.unlink(tempPath);
1083
1087
  throw new Error(`Only ${_conf.allowedExts_drive.toString()} files are allowed!`);
1084
1088
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.1381",
3
+ "version": "1.1.1383",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {