From 6b7f929ec5e2bccb07eab22c808e18a6f450e728 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 8 Jul 2025 09:47:37 -0400 Subject: [PATCH] [mv3] Fix spurious filter conversion when pasting in editor --- platform/mv3/extension/js/ubo-parser.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/mv3/extension/js/ubo-parser.js b/platform/mv3/extension/js/ubo-parser.js index a62d2626e..67d16673e 100644 --- a/platform/mv3/extension/js/ubo-parser.js +++ b/platform/mv3/extension/js/ubo-parser.js @@ -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);