gh-106217: Truncate the issue body size of `new-bugs-announce-notifier` by sobolevn · Pull Request #106329 · python/cpython
Aha, looking at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring, the args are:
substring(indexStart) substring(indexStart, indexEnd)
indexStart
The index of the first character to include in the returned substring.
indexEndOptional
The index of the first character to exclude from the returned substring.
So:
issue.data.body.substring(8000)
is attempting to get the substring from char number 8000 up to the end, meaning we lose the first 8000 chars, and get an empty string if there's nothing beyond that. For example:
const str = 'Mozilla'; console.log(str.substring(4)); // prints "lla" console.log(str.substring(8000)); // prints ""
Instead we want something like issue.data.body.substring(0, 8000) for the substring from 0 up to 8000.
console.log(str.substring(0, 4)); // "Mozi" console.log(str.substring(0, 8000)); // "Mozilla"
Does that look right? Would you like to make a new PR?