@xuda.io/drive_module 1.1.1281 → 1.1.1283
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.mjs +9 -6
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -476,7 +476,7 @@ export const delete_drive_files = async (req, job_id, headers) => {
|
|
|
476
476
|
for await (const file of files_arr) {
|
|
477
477
|
let doc = await get_drive_doc(file.type, drive_type, app_id, uid, file.file_path, headers);
|
|
478
478
|
|
|
479
|
-
if (doc.
|
|
479
|
+
if (doc.is_protected) {
|
|
480
480
|
throw new Error(`${doc.type} protected`);
|
|
481
481
|
}
|
|
482
482
|
|
|
@@ -650,7 +650,7 @@ export const update_drive_file = async (req, job_id, headers, file_obj) => {
|
|
|
650
650
|
|
|
651
651
|
export const create_drive_folder = async (req, job_id, headers) => {
|
|
652
652
|
try {
|
|
653
|
-
const { drive_type, app_id, folder_name, uid,
|
|
653
|
+
const { drive_type, app_id, folder_name, uid, is_protected, path: file_path } = req;
|
|
654
654
|
validate_drive_type(drive_type);
|
|
655
655
|
|
|
656
656
|
let folder_id;
|
|
@@ -671,7 +671,7 @@ export const create_drive_folder = async (req, job_id, headers) => {
|
|
|
671
671
|
is_folder: true,
|
|
672
672
|
type: 'directory',
|
|
673
673
|
file_path,
|
|
674
|
-
|
|
674
|
+
is_protected,
|
|
675
675
|
};
|
|
676
676
|
|
|
677
677
|
let check_req = {
|
|
@@ -688,7 +688,7 @@ export const create_drive_folder = async (req, job_id, headers) => {
|
|
|
688
688
|
if (check_existing_file_ret.code < 0) {
|
|
689
689
|
throw new Error(check_existing_file_ret.data);
|
|
690
690
|
}
|
|
691
|
-
|
|
691
|
+
debugger;
|
|
692
692
|
switch (drive_type) {
|
|
693
693
|
case 'studio': {
|
|
694
694
|
folder_id = req.folder_name;
|
|
@@ -700,6 +700,9 @@ export const create_drive_folder = async (req, job_id, headers) => {
|
|
|
700
700
|
};
|
|
701
701
|
}
|
|
702
702
|
target_dir = file_path + '/' + folder_id;
|
|
703
|
+
if (check_req.type === 'directory') {
|
|
704
|
+
target_dir = path.join(file_path, folder_id);
|
|
705
|
+
}
|
|
703
706
|
folder_exist = await file_exists(target_dir);
|
|
704
707
|
if (folder_exist) {
|
|
705
708
|
throw new Error('folder exist');
|
|
@@ -1022,7 +1025,7 @@ export const delete_file_bulk = async (req) => {
|
|
|
1022
1025
|
|
|
1023
1026
|
export const upload_drive_file = async (req, job_id, headers, file_obj) => {
|
|
1024
1027
|
try {
|
|
1025
|
-
const { drive_type, app_id, uid, make_public, tags = '',
|
|
1028
|
+
const { drive_type, app_id, uid, make_public, tags = '', is_protected, path: file_path } = req;
|
|
1026
1029
|
|
|
1027
1030
|
/// validations
|
|
1028
1031
|
validate_drive_type(drive_type);
|
|
@@ -1069,7 +1072,7 @@ export const upload_drive_file = async (req, job_id, headers, file_obj) => {
|
|
|
1069
1072
|
size: stat.isFile() ? stat.size : 0,
|
|
1070
1073
|
public: make_public,
|
|
1071
1074
|
tags: tags_arr,
|
|
1072
|
-
|
|
1075
|
+
is_protected,
|
|
1073
1076
|
};
|
|
1074
1077
|
doc = { ...doc, ...(await get_file_info(tempPath)) };
|
|
1075
1078
|
|