Code review: safer to split on official line separator

Will still join lines using the detected line separator.
This commit is contained in:
Raymond Hill 2025-05-30 11:19:12 -04:00
parent 008fc488c1
commit 55d45a6fb1
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -375,7 +375,7 @@ registerScriptlet(trustedJsonEditFetchResponse, {
function jsonlEditFn(jsonp, text = '') {
const safe = safeSelf();
const lineSeparator = /\r?\n/.exec(text)?.[0] || '\n';
const linesBefore = text.split(lineSeparator);
const linesBefore = text.split('\n');
const linesAfter = [];
for ( const lineBefore of linesBefore ) {
let obj;