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
@@ -37,7 +37,8 @@ const makeEmail = async (to, from, subject, html, url, pdfName) => {
let Pdf = fs.createWriteStream('test.pdf');
const writeToLocalDisk = () => {
return new Promise((resolve, reject) => {
const isSecure = new URL(url)?.protocol === 'https:';
const isSecure =
new URL(url)?.protocol === 'https:' && new URL(url)?.hostname !== 'localhost';
if (useLocal !== 'true' || isSecure) {
https.get(url, async function (response) {
response.pipe(Pdf);