From 90b8ddf404e22b9c0eb7f40b53bb3e4a6ebbc59e Mon Sep 17 00:00:00 2001 From: gorhill Date: Mon, 9 Feb 2015 20:12:37 -0500 Subject: [PATCH] this fixes #757 --- src/js/dyna-rules.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/js/dyna-rules.js b/src/js/dyna-rules.js index 7c11fc5e0..51575c171 100644 --- a/src/js/dyna-rules.js +++ b/src/js/dyna-rules.js @@ -97,8 +97,17 @@ function handleImportFilePicker() { if ( typeof this.result !== 'string' || this.result === '' ) { return; } + // https://github.com/gorhill/uBlock/issues/757 + // Support RequestPolicy rule syntax + var result = this.result; + var matches = /\[origins-to-destinations\]([^\[]+)/.exec(result); + if ( matches && matches.length === 2 ) { + result = matches[1].trim() + .replace(/\|/g, ' ') + .replace(/\n/g, ' * noop\n'); + } var textarea = uDom('#rulesEditor'); - textarea.val([textarea.val(), this.result].join('\n').trim()); + textarea.val([textarea.val(), result].join('\n').trim()); rulesChanged(); }; var file = this.files[0];