@xuda.io/drive_module 1.1.553 → 1.1.555

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.js +22 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1407,9 +1407,9 @@ exports.upload_drive_file = async function (req, job_id, headers, file_obj) {
1407
1407
  };
1408
1408
  }
1409
1409
 
1410
- if (await fs_module.file_exists(target_file)) {
1411
- await fs_module.unlink(target_file);
1412
- }
1410
+ // if (await fs_module.file_exists(target_file)) {
1411
+ // await fs_module.unlink(target_file);
1412
+ // }
1413
1413
  }
1414
1414
 
1415
1415
  await fs_module.copy(tempPath, target_file);
@@ -1477,15 +1477,29 @@ exports.upload_drive_file = async function (req, job_id, headers, file_obj) {
1477
1477
  break;
1478
1478
  }
1479
1479
  case "user": {
1480
+ if (check_exist) {
1481
+ const workspace_drive_res = await db_module.find_couch_query(
1482
+ "drive",
1483
+ {
1484
+ selector: { docType: "workspace_drive", originalname, stat: 3 },
1485
+ limit: 99,
1486
+ }
1487
+ );
1488
+ if (workspace_drive_res.docs.length) {
1489
+ return {
1490
+ code: -762,
1491
+ data: "file already exist",
1492
+ duplicates: workspace_drive_res.docs,
1493
+ };
1494
+ }
1495
+ }
1496
+
1480
1497
  ref = uid;
1481
1498
  file_name =
1482
1499
  "drv_" + ref + "_" + (await _common.xuda_get_uuid(drive_type)) + ext;
1483
- // target_file = path.join(
1484
- // req.path !== "/" ? req.path : target_dir,
1485
- // file_name
1486
- // );
1500
+
1487
1501
  doc.server_file_name = file_name;
1488
- // doc.uid = uid;
1502
+
1489
1503
  doc.bucket = {
1490
1504
  [`${process.env.XUDA_HOSTNAME}`]: await upload_file_to_spaces(
1491
1505
  tempPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.553",
3
+ "version": "1.1.555",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {