@xuda.io/drive_module 1.1.601 → 1.1.603
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 +14 -11
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1569,17 +1569,17 @@ exports.upload_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
};
|
|
1571
1571
|
exports.check_drive_file = async function (req, job_id, headers, file_obj) {
|
|
1572
|
-
const { drive_type, app_id, uid,
|
|
1573
|
-
var
|
|
1572
|
+
const { drive_type, app_id, uid, file_name, file_path } = req;
|
|
1573
|
+
var master_app_id;
|
|
1574
1574
|
|
|
1575
1575
|
switch (drive_type) {
|
|
1576
1576
|
case "studio": {
|
|
1577
|
-
|
|
1577
|
+
master_app_id = await _common.get_project_app_id(req.app_id, true);
|
|
1578
1578
|
const target_dir = path.join(_conf[`studio_drive_path`], ref);
|
|
1579
|
-
file_name = path.join(file_path.replace(target_dir, ""), originalname);
|
|
1579
|
+
// file_name = path.join(file_path.replace(target_dir, ""), originalname);
|
|
1580
1580
|
target_file = path.join(
|
|
1581
1581
|
file_path !== "/" ? file_path : target_dir,
|
|
1582
|
-
|
|
1582
|
+
file_name
|
|
1583
1583
|
);
|
|
1584
1584
|
|
|
1585
1585
|
if (await fs_module.file_exists(target_file)) {
|
|
@@ -1592,12 +1592,15 @@ exports.check_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
1592
1592
|
break;
|
|
1593
1593
|
}
|
|
1594
1594
|
case "workspace": {
|
|
1595
|
-
|
|
1595
|
+
master_app_id = await _common.get_project_app_id(req.app_id, true);
|
|
1596
1596
|
|
|
1597
|
-
const workspace_drive_res = await db_module.find_app_couch_query(
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1597
|
+
const workspace_drive_res = await db_module.find_app_couch_query(
|
|
1598
|
+
master_app_id,
|
|
1599
|
+
{
|
|
1600
|
+
selector: { docType: "workspace_drive", file_name, stat: 3 },
|
|
1601
|
+
limit: 99,
|
|
1602
|
+
}
|
|
1603
|
+
);
|
|
1601
1604
|
if (workspace_drive_res.docs.length) {
|
|
1602
1605
|
return {
|
|
1603
1606
|
code: -764,
|
|
@@ -1610,7 +1613,7 @@ exports.check_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
1610
1613
|
}
|
|
1611
1614
|
case "user": {
|
|
1612
1615
|
const user_drive_res = await db_module.find_couch_query("xuda_drive", {
|
|
1613
|
-
selector: { docType: "user_drive",
|
|
1616
|
+
selector: { docType: "user_drive", file_name, uid, stat: 3 },
|
|
1614
1617
|
limit: 99,
|
|
1615
1618
|
});
|
|
1616
1619
|
if (user_drive_res.docs.length) {
|