Respond with bad request when MKCOL, MCALENDAR or MOVE fails
This commit is contained in:
parent
48d2a33053
commit
02371685bd
@ -620,7 +620,12 @@ class Application:
|
||||
props["tag"] = "VCALENDAR"
|
||||
# TODO: use this?
|
||||
# timezone = props.get("C:calendar-timezone")
|
||||
try:
|
||||
self.Collection.create_collection(path, props=props)
|
||||
except ValueError as e:
|
||||
self.logger.warning(
|
||||
"Bad MKCALENDAR request on %r: %s", path, e, exc_info=True)
|
||||
return BAD_REQUEST
|
||||
return client.CREATED, {}, None
|
||||
|
||||
def do_MKCOL(self, environ, base_prefix, path, user):
|
||||
@ -638,7 +643,12 @@ class Application:
|
||||
if item:
|
||||
return WEBDAV_PRECONDITION_FAILED
|
||||
props = xmlutils.props_from_request(xml_content)
|
||||
try:
|
||||
self.Collection.create_collection(path, props=props)
|
||||
except ValueError as e:
|
||||
self.logger.warning(
|
||||
"Bad MKCOL request on %r: %s", path, e, exc_info=True)
|
||||
return BAD_REQUEST
|
||||
return client.CREATED, {}, None
|
||||
|
||||
def do_MOVE(self, environ, base_prefix, path, user):
|
||||
@ -682,7 +692,12 @@ class Application:
|
||||
if not to_collection:
|
||||
return WEBDAV_PRECONDITION_FAILED
|
||||
to_href = posixpath.basename(to_path.strip("/"))
|
||||
try:
|
||||
self.Collection.move(item, to_collection, to_href)
|
||||
except ValueError as e:
|
||||
self.logger.warning(
|
||||
"Bad MOVE request on %r: %s", path, e, exc_info=True)
|
||||
return BAD_REQUEST
|
||||
return client.CREATED, {}, None
|
||||
|
||||
def do_OPTIONS(self, environ, base_prefix, path, user):
|
||||
|
Loading…
Reference in New Issue
Block a user