1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-26 16:45:52 +00:00

Merge pull request #1766 from pbiering/fix-1765-put-update

Fix 1765 put update
This commit is contained in:
Peter Bieringer 2025-04-22 21:36:46 +02:00 committed by GitHub
commit fef157bb50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View file

@ -4,6 +4,7 @@
* Adjust: [auth] ldap: use ldap_user_attr either first element of list or directly
* Fix: use value of property for time range filter
* Add: [auth] ldap: option ldap_security (none, startls, tls) for additional support of STARTTLS, deprecate ldap_use_ssl
* Fix: return 204 instead of 201 in case PUT updates an item
## 3.5.1

View file

@ -282,6 +282,10 @@ class ApplicationPartPut(ApplicationBase):
logger.warning(
"Bad PUT request on %r (upload): %s", path, e, exc_info=True)
return httputils.BAD_REQUEST
if (item and item.uid == prepared_item.uid):
logger.debug("PUT request updated existing item %r", path)
headers = {"ETag": etag}
return client.NO_CONTENT, headers, None
headers = {"ETag": etag}
return client.CREATED, headers, None

View file

@ -1,7 +1,7 @@
# This file is part of Radicale - CalDAV and CardDAV server
# Copyright © 2012-2017 Guillaume Ayoub
# Copyright © 2017-2022 Unrud <unrud@outlook.com>
# Copyright © 2024-2024 Peter Bieringer <pb@bieringer.de>
# Copyright © 2024-2025 Peter Bieringer <pb@bieringer.de>
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -222,7 +222,7 @@ permissions: RrWw""")
event_modified = get_file_content("event1_modified.ics")
path = "/calendar.ics/event1.ics"
self.put(path, event)
self.put(path, event_modified)
self.put(path, event_modified, check=204)
_, answer = self.get("/calendar.ics/")
assert answer.count("BEGIN:VEVENT") == 1
_, answer = self.get(path)
@ -1594,8 +1594,8 @@ permissions: RrWw""")
self.put(event_path, event1)
sync_token, responses = self._report_sync_token(calendar_path)
assert len(responses) == 1 and responses[event_path] == 200
self.put(event_path, event2)
self.put(event_path, event1)
self.put(event_path, event2, check=204)
self.put(event_path, event1, check=204)
sync_token, responses = self._report_sync_token(
calendar_path, sync_token)
if not self.full_sync_token_support and not sync_token: