@xuda.io/drive_module 1.1.566 → 1.1.568
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 +9 -24
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1535,17 +1535,14 @@ exports.upload_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
};
|
|
1537
1537
|
exports.check_drive_file = async function (req, job_id, headers, file_obj) {
|
|
1538
|
-
const { drive_type, app_id, uid,
|
|
1538
|
+
const { drive_type, app_id, uid, originalname } = req;
|
|
1539
1539
|
var file_name, ref;
|
|
1540
1540
|
|
|
1541
1541
|
switch (drive_type) {
|
|
1542
1542
|
case "studio": {
|
|
1543
1543
|
ref = await _common.get_project_app_id(req.app_id, true);
|
|
1544
1544
|
const target_dir = path.join(_conf[`studio_drive_path`], ref);
|
|
1545
|
-
file_name = path.join(
|
|
1546
|
-
req.path.replace(target_dir, ""),
|
|
1547
|
-
file_obj.originalname
|
|
1548
|
-
);
|
|
1545
|
+
file_name = path.join(req.path.replace(target_dir, ""), originalname);
|
|
1549
1546
|
target_file = path.join(
|
|
1550
1547
|
req.path !== "/" ? req.path : target_dir,
|
|
1551
1548
|
originalname
|
|
@@ -1587,35 +1584,23 @@ exports.check_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
1587
1584
|
});
|
|
1588
1585
|
if (user_drive_res.docs.length) {
|
|
1589
1586
|
return {
|
|
1590
|
-
code: -
|
|
1591
|
-
data: "file
|
|
1587
|
+
code: -764,
|
|
1588
|
+
data: "file exist",
|
|
1592
1589
|
duplicates: user_drive_res.docs,
|
|
1593
1590
|
};
|
|
1594
1591
|
}
|
|
1595
1592
|
|
|
1596
|
-
ref = uid;
|
|
1597
|
-
file_name =
|
|
1598
|
-
"drv_" + ref + "_" + (await _common.xuda_get_uuid(drive_type)) + ext;
|
|
1599
|
-
|
|
1600
|
-
doc.server_file_name = file_name;
|
|
1601
|
-
|
|
1602
|
-
doc.bucket = {
|
|
1603
|
-
[`${process.env.XUDA_HOSTNAME}`]: await upload_file_to_spaces(
|
|
1604
|
-
tempPath,
|
|
1605
|
-
ref,
|
|
1606
|
-
drive_type,
|
|
1607
|
-
file_name
|
|
1608
|
-
),
|
|
1609
|
-
};
|
|
1610
|
-
doc._id = file_name;
|
|
1611
|
-
save_ret = await db_module.save_couch_doc("xuda_drive", doc);
|
|
1612
|
-
misc_module.rsync_drive_resources_to_remote_servers("user", uid);
|
|
1613
1593
|
break;
|
|
1614
1594
|
}
|
|
1615
1595
|
|
|
1616
1596
|
default:
|
|
1617
1597
|
break;
|
|
1618
1598
|
}
|
|
1599
|
+
|
|
1600
|
+
return {
|
|
1601
|
+
code: 764,
|
|
1602
|
+
data: "ok",
|
|
1603
|
+
};
|
|
1619
1604
|
};
|
|
1620
1605
|
const ocr_drive_file = async function (doc) {
|
|
1621
1606
|
const { drive_type, target_file } = doc;
|