@xuda.io/drive_module 1.1.1118 → 1.1.1120
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 +8 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -668,9 +668,10 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
668
668
|
doc = { ...doc, ...(await get_file_info(tempPath)) };
|
|
669
669
|
|
|
670
670
|
let save_ret;
|
|
671
|
-
|
|
671
|
+
let ref
|
|
672
672
|
switch (drive_type) {
|
|
673
673
|
case "studio": {
|
|
674
|
+
ref = await _common.get_project_app_id(app_id, true);
|
|
674
675
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
675
676
|
save_ret = await db_module.save_app_couch_doc(app_id_reference, doc);
|
|
676
677
|
|
|
@@ -681,8 +682,10 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
681
682
|
break;
|
|
682
683
|
}
|
|
683
684
|
case "workspace": {
|
|
685
|
+
|
|
684
686
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
685
687
|
const app_id_master = await _common.get_project_app_id(app_id, true);
|
|
688
|
+
ref = app_id_master;
|
|
686
689
|
|
|
687
690
|
doc.bucket[`${process.env.XUDA_HOSTNAME}`] =
|
|
688
691
|
await upload_file_to_spaces(
|
|
@@ -700,6 +703,7 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
700
703
|
break;
|
|
701
704
|
}
|
|
702
705
|
case "user": {
|
|
706
|
+
ref = uid;
|
|
703
707
|
doc.bucket[`${process.env.XUDA_HOSTNAME}`] =
|
|
704
708
|
await upload_file_to_spaces(tempPath, uid, drive_type, file_name);
|
|
705
709
|
save_ret = await db_module.save_couch_doc("xuda_drive", doc);
|
|
@@ -719,12 +723,14 @@ exports.update_drive_file = async function (req, job_id, headers, file_obj) {
|
|
|
719
723
|
}/${drive_type}-drive${drive_type === "studio" ? `/${master_id}/${target_file}` : file_name
|
|
720
724
|
}`;
|
|
721
725
|
|
|
726
|
+
let file_url = get_file_url(drive_type, file_name, ref);
|
|
727
|
+
|
|
722
728
|
misc_module.purge_cloudflare_cache(false, server_file_name);
|
|
723
729
|
return {
|
|
724
730
|
code: 760,
|
|
725
731
|
data: {
|
|
726
732
|
server_file_name,
|
|
727
|
-
filename: file_obj.originalname,
|
|
733
|
+
filename: file_obj.originalname, file_url
|
|
728
734
|
},
|
|
729
735
|
};
|
|
730
736
|
} catch (err) {
|