@xuda.io/drive_module 1.1.476 → 1.1.477

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.
Files changed (2) hide show
  1. package/index.js +18 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -545,7 +545,24 @@ exports.delete_drive_files = async function (req) {
545
545
 
546
546
  case "user": {
547
547
  doc_ret = await db_module.get_couch_doc("xuda_drive", file.name);
548
- await module.exports.delete_file_from_bucket(doc_ret.data.bucket);
548
+ if (doc_ret.data.type === "file") {
549
+ await module.exports.delete_file_from_bucket(doc_ret.data.bucket);
550
+ }
551
+ if (doc_ret.data.type === "directory") {
552
+ const docs = await get_folder_docs(
553
+ path.basename(file.path),
554
+ drive_type,
555
+ null
556
+ );
557
+ for await (let doc of docs) {
558
+ if (doc.type === "file") {
559
+ await module.exports.delete_file_from_bucket(doc.bucket);
560
+ }
561
+ doc.ts = Date.now();
562
+ doc.stat = 4;
563
+ await db_module.save_couch_doc("xuda_drive", doc);
564
+ }
565
+ }
549
566
  doc_ret.data.ts = Date.now();
550
567
  doc_ret.data.stat = 4;
551
568
  save_ret = await db_module.save_couch_doc("xuda_drive", doc_ret.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.476",
3
+ "version": "1.1.477",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {