1
0
mirror of https://github.com/etesync/server synced 2024-11-22 08:48:07 +00:00

Handle stoken being the empty string.

For whatever reason some users were getting this which was causing this code
to fail.
This commit is contained in:
Tom Hacohen 2021-02-01 18:40:11 +02:00
parent b33a3c882e
commit 14b3cfca55
2 changed files with 2 additions and 2 deletions

View File

@ -473,7 +473,7 @@ def item_bulk_common(
with transaction.atomic(): # We need this for locking the collection object
collection_object = queryset.select_for_update().get(uid=uid)
if stoken is not None and stoken != collection_object.stoken:
if stoken and stoken != collection_object.stoken:
raise HttpError("stale_stoken", "Stoken is too old", status_code=status.HTTP_409_CONFLICT)
data.validate_db()

View File

@ -12,7 +12,7 @@ StokenAnnotation = t.Any
def get_stoken_obj(stoken: t.Optional[str]) -> t.Optional[Stoken]:
if stoken is not None:
if stoken:
try:
return Stoken.objects.get(uid=stoken)
except Stoken.DoesNotExist: