Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rules with nested ifs are broken when saved #8011

Closed
ezaquarii opened this issue Apr 17, 2021 · 2 comments
Closed

Rules with nested ifs are broken when saved #8011

ezaquarii opened this issue Apr 17, 2021 · 2 comments

Comments

@ezaquarii
Copy link

ezaquarii commented Apr 17, 2021

I have the following sieve script:

<some rules before nested-if rule>

if address :contains ["From"] "domain.net" { 
    if address :contains ["From"] "foo" {
        fileinto "Domain.Foo";
    } elsif header :contains "Subject" "bar" {
        fileinto "Domain.Bar";
    } else {
        fileinto "Domain";
    }
}

if header :contains "Subject" ["TAG"] {
    fileinto "Tagged";
}

if address :contains ["To", "Cc"] "someaddress@domain.net" { 
    fileinto "SomeAddress";
}

When the script is saved, the resulting sieve script is:

<some rules before nested-if rule>

fileinto "Tagged";

This seems to be a similar issue to #5540 where the proposal was to drop nested ifs rules on save. Something went wrong here as the rules are dropped, but rules following the dropped one are damaged and deleted as well.

I'd propose an alternative solution instead:

When a rule cannot be parsed to display it in the visual editor, display it as a text field with source code instead

Please at least warn the user that the editor could not load all the rules, as otherwise the user will save a damaged script.
Blocking the visual editor until the script can be parsed correctly would also be beneficial.

@alecpl
Copy link
Member

alecpl commented Apr 18, 2021

I don't like the alternative solution. Managesieve plugin is not a sieve editor. It is a simple interface not requiring knowledge about sieve syntax. So, it has some limitations. The same as we don't support "else" we do not support nesting. If you need all these features use the "Edit filter set" action.

The bug should be investigated, though.

@alecpl
Copy link
Member

alecpl commented Apr 18, 2021

Fixed.

@alecpl alecpl closed this as completed Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants