@xuda.io/drive_module 1.1.765 → 1.1.767
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 +18 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -934,19 +934,28 @@ exports.create_drive_folder = async function (req, job_id, headers) {
|
|
|
934
934
|
};
|
|
935
935
|
exports.rename_drive_file = async function (req) {
|
|
936
936
|
try {
|
|
937
|
-
const { drive_type, app_id, file_name_id, file_name_to } = req;
|
|
937
|
+
const { drive_type, app_id, file_name_id, file_name_to, file_path } = req;
|
|
938
938
|
validate_drive_type(drive_type);
|
|
939
939
|
|
|
940
|
+
let check_req = {
|
|
941
|
+
app_id,
|
|
942
|
+
uid,
|
|
943
|
+
drive_type,
|
|
944
|
+
file_path,
|
|
945
|
+
};
|
|
946
|
+
const check_existing_file_ret = await module.exports.check_drive_file(
|
|
947
|
+
check_req
|
|
948
|
+
);
|
|
949
|
+
|
|
950
|
+
var target_file = file_name;
|
|
951
|
+
|
|
940
952
|
let doc_ret;
|
|
941
953
|
|
|
942
954
|
switch (drive_type) {
|
|
943
955
|
case "studio": {
|
|
944
956
|
const app_id_master = await _common.get_project_app_id(app_id, true);
|
|
945
|
-
doc_ret = await db_module.get_app_couch_doc(
|
|
946
|
-
|
|
947
|
-
file_name_id
|
|
948
|
-
);
|
|
949
|
-
await fs_module.rename(file_name_id, file_name_to);
|
|
957
|
+
doc_ret = await db_module.get_app_couch_doc(app_id_master, file_path);
|
|
958
|
+
await fs_module.rename(file_path, file_name_to);
|
|
950
959
|
if (doc_ret.code > -1) {
|
|
951
960
|
doc_ret.data._delete = true;
|
|
952
961
|
save_ret = await db_module.save_app_couch_doc(
|
|
@@ -967,7 +976,7 @@ exports.rename_drive_file = async function (req) {
|
|
|
967
976
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
968
977
|
doc_ret = await db_module.get_app_couch_doc(
|
|
969
978
|
app_id_reference,
|
|
970
|
-
|
|
979
|
+
check_existing_file_ret.duplicates[0]._id
|
|
971
980
|
);
|
|
972
981
|
if (doc_ret.code < 0) {
|
|
973
982
|
throw new Error(doc_ret.data);
|
|
@@ -979,7 +988,7 @@ exports.rename_drive_file = async function (req) {
|
|
|
979
988
|
case "user":
|
|
980
989
|
doc_ret = await db_module.get_couch_doc(
|
|
981
990
|
"xuda_drive",
|
|
982
|
-
|
|
991
|
+
check_existing_file_ret.duplicates[0]._id
|
|
983
992
|
);
|
|
984
993
|
if (doc_ret.code < 0) {
|
|
985
994
|
throw new Error(doc_ret.data);
|
|
@@ -1139,7 +1148,7 @@ exports.rename_drive_folder = async function (req) {
|
|
|
1139
1148
|
};
|
|
1140
1149
|
exports.update_drive_file_sharing_mode = async function (req, job_id, headers) {
|
|
1141
1150
|
try {
|
|
1142
|
-
const { drive_type, uid, app_id, is_public } = req;
|
|
1151
|
+
const { drive_type, uid, app_id, file_path, is_public } = req;
|
|
1143
1152
|
|
|
1144
1153
|
validate_drive_type(drive_type);
|
|
1145
1154
|
|
|
@@ -2411,7 +2420,6 @@ exports.update_drive_file_tags = async function (req, job_id, headers) {
|
|
|
2411
2420
|
app_id,
|
|
2412
2421
|
uid,
|
|
2413
2422
|
drive_type,
|
|
2414
|
-
|
|
2415
2423
|
file_path,
|
|
2416
2424
|
};
|
|
2417
2425
|
const check_existing_file_ret = await module.exports.check_drive_file(
|