diff --git a/lib/notification/adapter/ntfy.js b/lib/notification/adapter/ntfy.js index db1859d..e217580 100644 --- a/lib/notification/adapter/ntfy.js +++ b/lib/notification/adapter/ntfy.js @@ -15,11 +15,17 @@ Size: ${newListing.size == null ? 'N/A' : newListing.size.replace(/2m/g, '$m^2$' Price: ${newListing.price} Link: ${newListing.link}`; + const sanitizeHeaderValue = (value) => + String(value ?? '') + .replace(/[\r\n]+/g, ' ') + .replace(/[^\x20-\x7E]/g, ' ') + .trim(); + const headers = { - Title: newListing.title, - Priority: String(priority), - Tags: `${serviceName},${jobName}`, - Click: newListing.link, + Title: sanitizeHeaderValue(newListing.title), + Priority: sanitizeHeaderValue(priority), + Tags: sanitizeHeaderValue(`${serviceName},${jobName}`), + Click: sanitizeHeaderValue(newListing.link), }; if (newListing.image && typeof newListing.image === 'string') { diff --git a/package.json b/package.json index f6749d7..109efae 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fredy", - "version": "12.2.1", + "version": "12.2.2", "description": "[F]ind [R]eal [E]states [d]amn eas[y].", "scripts": { "prepare": "husky",