vdirsyncer/vdirsyncer
Colin Watson c79d3680cd Fix _Component.__delitem__ with adjacent identical keys
Hypothesis found the following example:

```
tests/unit/utils/test_vobject.py:335: in add_prop
    assert c[key] == value
E   AssertionError: assert '0' == '1'
E
E     - 1
E     + 0
E   Falsifying example:
E   state = VobjectMachine()
E   unparsed_0 = state.get_unparsed_lines(encoded=False, joined=False)
E   parsed_0 = state.parse(unparsed=unparsed_0)
E   state.add_prop_raw(c=parsed_0, key='0', params=[], value='0')
E   state.add_prop_raw(c=parsed_0, key='0', params=[], value='0')
E   state.add_prop(c=parsed_0, key='0', value='1')
E   state.teardown()
```

After the two `add_prop_raw` calls, `c.props` is `["0;:0", "0;:0",
"FOO:YES"]`.  `_Component.__delitem__` then fails to effectively delete
the previous key: it deletes the first `"0;:0"` item, but then checks
for continuation lines following it and incorrectly keeps the second
`"0;:0"` item even though it begins with one of the prefixes it's trying
to delete.  Checking for the prefix in the check for continuation lines
fixes this.

Fixes: #1149
2024-12-20 01:43:15 +00:00
..
cli Formatting 2024-08-26 12:49:36 +02:00
storage storage/http: add support for filter_hook 2024-12-08 19:31:32 +01:00
sync Add some type hints 2024-02-20 15:08:51 +01:00
__init__.py Pre-commit autoupdate 2024-01-31 19:08:25 +01:00
__main__.py Ensure type annotations are backwards compatible 2023-10-29 16:04:23 +01:00
exceptions.py Pre-commit autoupdate 2024-01-31 19:08:25 +01:00
http.py Do not load netrc config files 2024-12-09 01:32:29 +01:00
metasync.py Ensure type annotations are backwards compatible 2023-10-29 16:04:23 +01:00
repair.py Ensure type annotations are backwards compatible 2023-10-29 16:04:23 +01:00
utils.py Ensure type annotations are backwards compatible 2023-10-29 16:04:23 +01:00
vobject.py Fix _Component.__delitem__ with adjacent identical keys 2024-12-20 01:43:15 +00:00