mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Fix severe bug in davstorage
where (href, etag) instead of etag would be returned. Thanks for @slavkoja for finding it.
This commit is contained in:
parent
91de80cef0
commit
5fd866b41b
3 changed files with 7 additions and 3 deletions
|
|
@ -71,7 +71,9 @@ class StorageTests(object):
|
|||
assert_item_equals(s.get(href)[0], item)
|
||||
|
||||
new_item = self._create_bogus_item()
|
||||
s.update(href, new_item, etag)
|
||||
new_etag = s.update(href, new_item, etag)
|
||||
# See https://github.com/untitaker/vdirsyncer/issues/48
|
||||
assert isinstance(new_etag, (bytes, text_type))
|
||||
assert_item_equals(s.get(href)[0], new_item)
|
||||
|
||||
def test_update_nonexisting(self):
|
||||
|
|
|
|||
|
|
@ -217,7 +217,8 @@ class DavStorage(Storage):
|
|||
href = self._normalize_href(href)
|
||||
if etag is None:
|
||||
raise ValueError('etag must be given and must not be None.')
|
||||
return self._put(href, item, etag)
|
||||
href, etag = self._put(href, item, etag)
|
||||
return etag
|
||||
|
||||
def upload(self, item):
|
||||
href = self._get_href(item)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
import itertools
|
||||
|
||||
from . import exceptions, log
|
||||
from .utils import iteritems
|
||||
from .utils import iteritems, text_type
|
||||
sync_logger = log.get(__name__)
|
||||
|
||||
|
||||
|
|
@ -152,6 +152,7 @@ def action_update(ident, source, dest):
|
|||
old_etag = dest_list[dest_href]['etag']
|
||||
item = source_list[source_href]['item']
|
||||
dest_etag = dest_storage.update(dest_href, item, old_etag)
|
||||
assert isinstance(dest_etag, (bytes, text_type))
|
||||
|
||||
source_status = (source_href, source_etag)
|
||||
dest_status = (dest_href, dest_etag)
|
||||
|
|
|
|||
Loading…
Reference in a new issue