Merge pull request #1969 from pbiering/pr-1968-testcase

Testcase for PR#1968
This commit is contained in:
Peter Bieringer
2026-01-22 06:48:59 +01:00
committed by GitHub
2 changed files with 33 additions and 1 deletions

View File

@@ -1,5 +1,9 @@
# Changelog # Changelog
## 3.6.1.dev
* Fix: MOVE failing with URL-encoded destination header
## 3.6.0 ## 3.6.0
* Extend: logwatch script * Extend: logwatch script

View File

@@ -1,7 +1,7 @@
# This file is part of Radicale - CalDAV and CardDAV server # This file is part of Radicale - CalDAV and CardDAV server
# Copyright © 2012-2017 Guillaume Ayoub # Copyright © 2012-2017 Guillaume Ayoub
# Copyright © 2017-2022 Unrud <unrud@outlook.com> # Copyright © 2017-2022 Unrud <unrud@outlook.com>
# Copyright © 2024-2025 Peter Bieringer <pb@bieringer.de> # Copyright © 2024-2026 Peter Bieringer <pb@bieringer.de>
# #
# This library is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@ Radicale tests with simple requests.
import logging import logging
import os import os
import posixpath import posixpath
import urllib
from typing import Any, Callable, ClassVar, Iterable, List, Optional, Tuple from typing import Any, Callable, ClassVar, Iterable, List, Optional, Tuple
import defusedxml.ElementTree as DefusedET import defusedxml.ElementTree as DefusedET
@@ -568,6 +569,33 @@ permissions: RrWw""")
self.get(path1, check=404) self.get(path1, check=404)
self.get(path2) self.get(path2)
def test_move_between_collections_with_at_native(self) -> None:
"""Move a item."""
self.mkcalendar("/calendar1@domain.ics/")
self.mkcalendar("/calendar2@domain.ics/")
event = get_file_content("event1.ics")
path1 = "/calendar1@domain.ics/event1.ics"
path2 = "/calendar2@domain.ics/event2.ics"
self.put(path1, event)
self.request("MOVE", path1, check=201,
HTTP_DESTINATION="http://127.0.0.1/"+path2)
self.get(path1, check=404)
self.get(path2)
def test_move_between_collections_with_at_encoded(self) -> None:
"""Move a item."""
self.mkcalendar("/calendar1@domain.ics/")
self.mkcalendar("/calendar2@domain.ics/")
event = get_file_content("event1.ics")
path1 = "/calendar1@domain.ics/event1.ics"
path2 = "/calendar2@domain.ics/event2.ics"
path2_encoded = urllib.parse.quote(path2)
self.put(path1, event)
self.request("MOVE", path1, check=201,
HTTP_DESTINATION="http://127.0.0.1/"+path2_encoded)
self.get(path1, check=404)
self.get(path2)
def test_move_between_collections_duplicate_uid(self) -> None: def test_move_between_collections_duplicate_uid(self) -> None:
"""Move a item to a collection which already contains the UID.""" """Move a item to a collection which already contains the UID."""
self.mkcalendar("/calendar1.ics/") self.mkcalendar("/calendar1.ics/")