@xuda.io/drive_module 1.1.563 → 1.1.565

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 +16 -37
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1553,54 +1553,33 @@ exports.check_drive_file = async function (req, job_id, headers, file_obj) {
1553
1553
 
1554
1554
  if (await fs_module.file_exists(target_file)) {
1555
1555
  return {
1556
- code: -762,
1556
+ code: -764,
1557
1557
  data: "file exist",
1558
1558
  };
1559
1559
  }
1560
1560
 
1561
- await fs_module.copy(tempPath, target_file);
1562
- doc.server_file_name = file_name;
1563
-
1564
- doc.app_id = app_id;
1565
- doc.app_id_reference = ref;
1566
-
1567
- doc._id = file_name;
1561
+ return {
1562
+ code: 764,
1563
+ data: "ok",
1564
+ };
1568
1565
 
1569
- save_ret = await db_module.save_app_couch_doc(ref, doc);
1570
- misc_module.rsync_drive_resources_to_remote_servers("studio", app_id);
1571
1566
  break;
1572
1567
  }
1573
1568
  case "workspace": {
1574
1569
  ref = await _common.get_project_app_id(req.app_id, true);
1575
- file_name =
1576
- "drv_" + ref + "_" + (await _common.xuda_get_uuid(drive_type)) + ext;
1577
-
1578
- // keep the original filename to support migration
1579
- if (file_obj.originalname.includes(`drv_${ref}`)) {
1580
- file_name = file_obj.originalname;
1581
- }
1582
-
1583
- doc.server_file_name = file_name;
1584
-
1585
- doc.app_id = app_id;
1586
- doc.app_id_reference = ref;
1587
1570
 
1588
1571
  /// check existing file
1589
- if (check_exist) {
1590
- const workspace_drive_res = await db_module.find_app_couch_query(
1591
- app_id,
1592
- {
1593
- selector: { docType: "workspace_drive", originalname, stat: 3 },
1594
- limit: 99,
1595
- }
1596
- );
1597
- if (workspace_drive_res.docs.length) {
1598
- return {
1599
- code: -762,
1600
- data: "file already exist",
1601
- duplicates: workspace_drive_res.docs,
1602
- };
1603
- }
1572
+
1573
+ const workspace_drive_res = await db_module.find_app_couch_query(app_id, {
1574
+ selector: { docType: "workspace_drive", originalname, stat: 3 },
1575
+ limit: 99,
1576
+ });
1577
+ if (workspace_drive_res.docs.length) {
1578
+ return {
1579
+ code: -762,
1580
+ data: "file already exist",
1581
+ duplicates: workspace_drive_res.docs,
1582
+ };
1604
1583
  }
1605
1584
 
1606
1585
  doc.bucket = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.563",
3
+ "version": "1.1.565",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {