@xuda.io/drive_module 1.1.1428 → 1.1.1430
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 +7 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -589,6 +589,13 @@ export const delete_drive_files = async (req, job_id, headers) => {
|
|
|
589
589
|
// get docs
|
|
590
590
|
let docs = [];
|
|
591
591
|
for await (const file of files_arr) {
|
|
592
|
+
if (doc.type === 'directory') {
|
|
593
|
+
const files_in_directory = await get_folder_files(uid, app_id, drive_type, path.join(doc.file_path, doc.folder_name));
|
|
594
|
+
if (files_in_directory?.length) {
|
|
595
|
+
throw new Error(`Directory is not empty`);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
592
599
|
try {
|
|
593
600
|
let doc = await get_drive_doc(file.type, drive_type, app_id, uid, file.file_path, headers);
|
|
594
601
|
doc.ts = Date.now();
|
|
@@ -665,9 +672,6 @@ export const delete_drive_files = async (req, job_id, headers) => {
|
|
|
665
672
|
await delete_file_from_bucket(doc.bucket);
|
|
666
673
|
} catch (error) {}
|
|
667
674
|
}
|
|
668
|
-
doc.ts = Date.now();
|
|
669
|
-
doc.stat = 4;
|
|
670
|
-
save_ret = await save_drive_doc(drive_type, uid, app_id, doc);
|
|
671
675
|
|
|
672
676
|
break;
|
|
673
677
|
}
|