From 369fedf3139b290df6b187dd7800ef4d11327469 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 24 Jan 2018 14:50:29 +0100 Subject: [PATCH] Fix bug where text: syntax was forced for strings longer than 1024 characters (#6143) --- CHANGELOG | 2 ++ plugins/managesieve/Changelog | 1 + plugins/managesieve/lib/Roundcube/rcube_sieve_script.php | 2 +- plugins/managesieve/tests/src/parser | 6 ++++++ plugins/managesieve/tests/src/parser.out | 6 ++++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index c261d8a85..386bccce6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ CHANGELOG Roundcube Webmail =========================== +- Managesieve: Fix bug where text: syntax was forced for strings longer than 1024 characters (#6143) + RELEASE 1.3.4 ------------- - Fix bug where contacts search could skip some records (#6130) diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index 5a61f3d36..39276ce94 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,3 +1,4 @@ +- Fix bug where text: syntax was forced for strings longer than 1024 characters (#6143) - Fix parsing dot-staffed lines in multiline text (#5838) - Fix AM/PM suffix in vacation time selectors - Fix bug where 'exists' operator was reset to 'contains' (#5899) diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php index 228213bee..0e49c98f5 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php @@ -1100,7 +1100,7 @@ class rcube_sieve_script } // multi-line string - if (preg_match('/[\r\n\0]/', $str) || strlen($str) > 1024) { + if (preg_match('/[\r\n\0]/', $str)) { return sprintf("text:\n%s\n.\n", self::escape_multiline_string($str)); } // quoted-string diff --git a/plugins/managesieve/tests/src/parser b/plugins/managesieve/tests/src/parser index c99b49814..0e2cef218 100644 --- a/plugins/managesieve/tests/src/parser +++ b/plugins/managesieve/tests/src/parser @@ -50,3 +50,9 @@ if envelope :domain :is "From" "domain.tld" fileinto "domain.tld"; stop; } +# rule:[do not wrap long lines] +if envelope :domain :is "From" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +{ + fileinto "domain.tld"; + stop; +} diff --git a/plugins/managesieve/tests/src/parser.out b/plugins/managesieve/tests/src/parser.out index 796343d4a..45712d036 100644 --- a/plugins/managesieve/tests/src/parser.out +++ b/plugins/managesieve/tests/src/parser.out @@ -50,3 +50,9 @@ if envelope :domain :is "From" "domain.tld" fileinto "domain.tld"; stop; } +# rule:[do not wrap long lines] +if envelope :domain :is "From" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +{ + fileinto "domain.tld"; + stop; +}