MIME-encode headers properly when editing filters

This commit is contained in:
Jamie Cameron
2018-04-21 13:26:59 -07:00
parent f336fffcff
commit 1b4cb64d38
3 changed files with 7 additions and 2 deletions

View File

@@ -87,6 +87,7 @@ else {
$regexp = 1;
}
}
$condvalue = &mailbox::decode_mimewords($condvalue);
print &ui_table_row(
&ui_oneradio("cmode", 4, $text{'edit_cmode4'}, $cmode == 4),
&text('edit_cheader2',

View File

@@ -533,6 +533,7 @@ return wantarray ? ( $cond, $lastalways ) : $cond;
# prettify_regexp(string)
# If a string contains only \ quoted special characters, remove the \s
# Also, undo any mimewords encoding.
sub prettify_regexp
{
my ($str) = @_;
@@ -541,7 +542,7 @@ $re =~ s/\\./x/g;
if ($re =~ /^[a-zA-Z0-9_ ]*$/) {
$str =~ s/\\(.)/$1/g;
}
return $str;
return &mailbox::decode_mimewords($str);
}
# describe_action(&filter, &folder, [homedir])

View File

@@ -83,7 +83,10 @@ else {
$filter->{'condheader'} = $in{'condmenu'} || $in{'condheader'};
$filter->{'condheader'} =~ /^[a-zA-Z0-9\-]+$/ ||
&error($text{'save_econdheader'});
$in{'condvalue'} = &mailbox::encode_mimeword($in{'condvalue'});
if ($in{'condvalue'} !~ /^[\000-\177]*$/) {
$in{'condvalue'} = &mailbox::encode_mimewords(
$in{'condvalue'}, 'Charset' => &get_charset());
}
if (!$in{'condregexp'} &&
$in{'condvalue'} =~ /[\^\$\.\*\+\?\|\(\)\[\]\{\}\\]/) {
# If the user didn't ask for a regexp but there are