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
@@ -33,7 +33,8 @@ async function sendMailProvider(req, plan, monthchange) {
let Pdf = fs.createWriteStream('test.pdf');
const writeToLocalDisk = () => {
return new Promise((resolve, reject) => {
if (useLocal !== 'true') {
const isSecure = new URL(url)?.protocol === 'https:';
if (useLocal !== 'true' || isSecure) {
https.get(req.params.url, async function (response) {
response.pipe(Pdf);
response.on('end', () => resolve('success'));
@@ -199,7 +200,8 @@ async function sendcustomsmtp(extRes, req) {
let Pdf = fs.createWriteStream('test.pdf');
const writeToLocalDisk = () => {
return new Promise((resolve, reject) => {
if (useLocal !== 'true') {
const isSecure = new URL(url)?.protocol === 'https:';
if (useLocal !== 'true' || isSecure) {
https.get(req.params.url, async function (response) {
response.pipe(Pdf);
response.on('end', () => resolve('success'));