fix: server get crash in self-hosting

This commit is contained in:
prafull-opensignlabs
2024-11-13 00:33:46 +05:30
parent 4db0d93f41
commit c893d96ad3
3 changed files with 9 additions and 3 deletions
@@ -33,7 +33,9 @@ async function sendMailProvider(req, plan, monthchange) {
let Pdf = fs.createWriteStream('test.pdf');
const writeToLocalDisk = () => {
return new Promise((resolve, reject) => {
const isSecure = new URL(req.params.url)?.protocol === 'https:';
const isSecure =
new URL(req.params.url)?.protocol === 'https:' &&
new URL(req.params.url)?.hostname !== 'localhost';
if (useLocal !== 'true' || isSecure) {
https.get(req.params.url, async function (response) {
response.pipe(Pdf);
@@ -200,7 +202,9 @@ async function sendcustomsmtp(extRes, req) {
let Pdf = fs.createWriteStream('test.pdf');
const writeToLocalDisk = () => {
return new Promise((resolve, reject) => {
const isSecure = new URL(req.params.url)?.protocol === 'https:';
const isSecure =
new URL(req.params.url)?.protocol === 'https:' &&
new URL(req.params.url)?.hostname !== 'localhost';
if (useLocal !== 'true' || isSecure) {
https.get(req.params.url, async function (response) {
response.pipe(Pdf);