@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.
- package/index.js +16 -37
- 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: -
|
|
1556
|
+
code: -764,
|
|
1557
1557
|
data: "file exist",
|
|
1558
1558
|
};
|
|
1559
1559
|
}
|
|
1560
1560
|
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
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
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
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 = {
|