ProtonMail / proton-mail-settings

React web application to manage ProtonMail settings
53 stars 13 forks source link

Wildcard is automatically added to filters with "begins with" or "ends with" condition #245

Closed EmilMN closed 4 years ago

EmilMN commented 4 years ago

Summary:

CS Report: https://proton.atlassian.net/browse/CLIENT-1863

If you create a filter through the GUI with "begins with" or "ends with", the resulting sieve has an additional "*" which causes the filter to work on all messages instead of the ones that match the selected conditions.

This filter:

image

Results in this Sieve code:

if allof (address :all :comparator "i;unicode-casemap" :matches "From" ["**string1***", "string2*", "*"]) {
    fileinto "F10";
}

The extra "*" is added only if you have an empty condition entry field in the GUI, which should be ignored.

If you're creating a filter that doesn't automatically add wildcards to the string, like Contains or Matches, but you still have an extra empty field displayed, an "" entry is added to the Sieve filter instead of "*".

Swiip commented 4 years ago

The change we decided here https://github.com/ProtonMail/proton-mail-settings/issues/236 has a drawback.

The last line is now considered as an active value. If you use it "as before" with a last empty line, it is considered as you wanted an empty string as a last value. It's not great, I agree, but it's what is hapening there.

Could we state that "empty string is not a valid value"? If yes, I can safely ignore an empty line. If not, there could be an ambiguity between line not used and a line used with an empty string.

matstaz commented 4 years ago

I see what is happening now. yes. Let's try to ignore the empty string @Swiip.