fix: pdf is not loading when custom file storage change

This commit is contained in:
prafull-opensignlabs
2024-10-08 20:09:38 +05:30
parent 23679e58e1
commit 761f81d27c
26 changed files with 294 additions and 210 deletions
@@ -19,7 +19,8 @@ async function uploadFile(pdfName, filepath, adapter) {
let fileUrl;
if (adapter?.bucketName) {
const adapterConfig = {
fileAdapter: adapter?.ActiveFileAdapter,
id: adapter?.id,
fileAdapter: adapter?.fileAdapter,
bucketName: adapter?.bucketName,
region: adapter?.region,
endpoint: adapter?.endpoint,
@@ -311,8 +312,9 @@ async function PDF(req) {
}
const _resDoc = resDoc?.toJSON();
// `FileAdapter` && `ActiveFileAdapter` is used to save file in user's fileAdapter
const FileAdapter = _resDoc?.ExtUserPtr?.TenantId?.FileAdapter;
const ActiveFileAdapter = _resDoc?.ExtUserPtr?.TenantId?.ActiveFileAdapter;
const FileAdapter =
_resDoc?.ExtUserPtr?.TenantId?.FileAdapters?.find(x => x.id === ActiveFileAdapter) || {};
let adapterConfig = {};
if (FileAdapter && ActiveFileAdapter) {
adapterConfig = { ActiveFileAdapter: ActiveFileAdapter, ...FileAdapter };