Pushover ttl Bug Fix (#1017)

* TTL Functionality

Pick up msg.ttl and pass it to REST API, checking it is a positive integer first.

* Update help doc

Reference ttl parameter in api docs

* Fix: Warnings with no ttl

Check if ttl exists before sanitizing

* Add: Allow string ttl

If ttl is a string, parse to integer and check validity

---------

Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
This commit is contained in:
wooferguy 2023-07-12 07:24:38 +12:00 committed by GitHub
parent 512697eec4
commit a058999f4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -63,9 +63,14 @@ module.exports = function(RED) {
expire = 10800;
node.warn("Expire time too high, using maximum setting of 10800s (3 hours) retry duration");
}
if (!Number.isInteger(ttl) || ttl<=0) {
ttl = null;
node.warn("No valid number for TTL found, not set");
if (ttl !== null) {
if(typeof ttl === "string") {
ttl = parseInt(ttl);
}
if(isNaN(ttl) || !Number.isInteger(ttl) || ttl <= 0) {
ttl = null;
node.warn("No valid number for TTL found, not set");
}
}
if (typeof msg.payload === 'undefined') { msg.payload = "(undefined msg.payload)"; }
if (typeof(msg.payload) === 'object') {