@xuda.io/drive_module 1.1.564 → 1.1.566
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 +11 -46
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1558,60 +1558,25 @@ exports.check_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
1558
1558
|
};
|
|
1559
1559
|
}
|
|
1560
1560
|
|
|
1561
|
-
return {
|
|
1562
|
-
code: 764,
|
|
1563
|
-
data: "ok",
|
|
1564
|
-
};
|
|
1565
|
-
|
|
1566
1561
|
break;
|
|
1567
1562
|
}
|
|
1568
1563
|
case "workspace": {
|
|
1569
1564
|
ref = await _common.get_project_app_id(req.app_id, true);
|
|
1570
|
-
file_name =
|
|
1571
|
-
"drv_" + ref + "_" + (await _common.xuda_get_uuid(drive_type)) + ext;
|
|
1572
|
-
|
|
1573
|
-
// keep the original filename to support migration
|
|
1574
|
-
if (file_obj.originalname.includes(`drv_${ref}`)) {
|
|
1575
|
-
file_name = file_obj.originalname;
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
doc.server_file_name = file_name;
|
|
1579
|
-
|
|
1580
|
-
doc.app_id = app_id;
|
|
1581
|
-
doc.app_id_reference = ref;
|
|
1582
1565
|
|
|
1583
1566
|
/// check existing file
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
data: "file already exist",
|
|
1596
|
-
duplicates: workspace_drive_res.docs,
|
|
1597
|
-
};
|
|
1598
|
-
}
|
|
1567
|
+
|
|
1568
|
+
const workspace_drive_res = await db_module.find_app_couch_query(app_id, {
|
|
1569
|
+
selector: { docType: "workspace_drive", originalname, stat: 3 },
|
|
1570
|
+
limit: 99,
|
|
1571
|
+
});
|
|
1572
|
+
if (workspace_drive_res.docs.length) {
|
|
1573
|
+
return {
|
|
1574
|
+
code: -764,
|
|
1575
|
+
data: "file exist",
|
|
1576
|
+
duplicates: workspace_drive_res.docs,
|
|
1577
|
+
};
|
|
1599
1578
|
}
|
|
1600
1579
|
|
|
1601
|
-
doc.bucket = {
|
|
1602
|
-
[`${process.env.XUDA_HOSTNAME}`]: await upload_file_to_spaces(
|
|
1603
|
-
tempPath,
|
|
1604
|
-
ref,
|
|
1605
|
-
drive_type,
|
|
1606
|
-
file_name
|
|
1607
|
-
),
|
|
1608
|
-
};
|
|
1609
|
-
doc._id = file_name;
|
|
1610
|
-
save_ret = await db_module.save_app_couch_doc(
|
|
1611
|
-
await _common.get_project_app_id(req.app_id),
|
|
1612
|
-
doc
|
|
1613
|
-
);
|
|
1614
|
-
misc_module.rsync_drive_resources_to_remote_servers("workspace", app_id);
|
|
1615
1580
|
break;
|
|
1616
1581
|
}
|
|
1617
1582
|
case "user": {
|