[mv3] Fix spurious filter conversion when pasting in editor

This commit is contained in:
Raymond Hill 2025-07-08 09:47:37 -04:00
parent 891b750de2
commit 6b7f929ec5
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -448,9 +448,13 @@ function parseNetworkFilter(parser) {
/******************************************************************************/
export function parseFilters(text) {
if ( text.startsWith('---') ) { return; }
if ( text.endsWith('---') ) { return; }
const lines = text.split(/\n/);
if ( lines.some(a => a.startsWith(' ')) ) { return; }
const rules = [];
const parser = new sfp.AstFilterParser({ trustedSource: true });
for ( const line of text.split(/\n/) ) {
for ( const line of lines ) {
parser.parse(line);
if ( parser.isNetworkFilter() === false ) { continue; }
const rule = parseNetworkFilter(parser);