@xuda.io/drive_module 1.1.648 → 1.1.650

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 +16 -14
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -399,9 +399,10 @@ exports.get_drive_file_info = async function (req) {
399
399
  doc_id,
400
400
  doc = {};
401
401
 
402
+ const app_id_master = await _common.get_project_app_id(app_id, true);
403
+
402
404
  switch (drive_type) {
403
405
  case "studio": {
404
- const app_id_master = await _common.get_project_app_id(app_id, true);
405
406
  const target_dir = path.join(_conf[`studio_drive_path`], app_id_master);
406
407
  doc_id = file_path.replace(target_dir, "");
407
408
  doc_ret = await db_module.get_app_couch_doc(app_id_master, doc_id);
@@ -409,7 +410,11 @@ exports.get_drive_file_info = async function (req) {
409
410
  }
410
411
 
411
412
  case "workspace": {
412
- if (type === "file" && !file_path.includes(app_id)) {
413
+ if (
414
+ type === "file" &&
415
+ !file_path.includes(app_id) &&
416
+ !file_path.includes(app_id_master)
417
+ ) {
413
418
  throw new Error("file_path unauthorized");
414
419
  }
415
420
  const app_id_reference = await _common.get_project_app_id(app_id);
@@ -713,12 +718,13 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
713
718
  const app_id_reference = await _common.get_project_app_id(app_id);
714
719
  const app_id_master = await _common.get_project_app_id(app_id, true);
715
720
 
716
- doc.bucket {[`${process.env.XUDA_HOSTNAME}`]: await upload_file_to_spaces(
717
- tempPath,
718
- app_id_master,
719
- drive_type,
720
- file_name
721
- )}
721
+ doc.bucket[`${process.env.XUDA_HOSTNAME}`] =
722
+ await upload_file_to_spaces(
723
+ tempPath,
724
+ app_id_master,
725
+ drive_type,
726
+ file_name
727
+ );
722
728
 
723
729
  save_ret = await db_module.save_app_couch_doc(app_id_reference, doc);
724
730
  misc_module.rsync_drive_resources_to_remote_servers(
@@ -728,12 +734,8 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
728
734
  break;
729
735
  }
730
736
  case "user": {
731
- doc.bucket ={[`${process.env.XUDA_HOSTNAME}`]: await upload_file_to_spaces(
732
- tempPath,
733
- uid,
734
- drive_type,
735
- file_name
736
- )}
737
+ doc.bucket[`${process.env.XUDA_HOSTNAME}`] =
738
+ await upload_file_to_spaces(tempPath, uid, drive_type, file_name);
737
739
  save_ret = await db_module.save_couch_doc("xuda_drive", doc);
738
740
  misc_module.rsync_drive_resources_to_remote_servers("user", doc.uid);
739
741
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.648",
3
+ "version": "1.1.650",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {