sharing: adjust result codes for unsupported calls
This commit is contained in:
@@ -947,7 +947,7 @@ class BaseSharing:
|
||||
Conversion = request_data['Conversion']
|
||||
# verify against whitelist
|
||||
if Conversion not in CONVERSIONS_WHITELIST:
|
||||
return httputils.bad_request("Conversion not supported: %r" % Conversion)
|
||||
return httputils.bad_request("Conversion is not supported: %r" % Conversion)
|
||||
|
||||
if 'Actions' in request_data:
|
||||
valid = True # default
|
||||
@@ -1060,11 +1060,11 @@ class BaseSharing:
|
||||
return httputils.NOT_FOUND
|
||||
if not isinstance(item, storage.BaseCollection):
|
||||
logger.warning(api_info + ": PathMapped=%r is not a collection", PathMapped)
|
||||
return httputils.METHOD_NOT_ALLOWED
|
||||
return httputils.bad_request("PathMapped is not a collection")
|
||||
if Conversion == "bday":
|
||||
if item.tag != "VADDRESSBOOK":
|
||||
logger.warning(api_info + ": PathMapped=%r is not a VADDRESSBOOK collection (mandatory for Conversion=%r)", PathMapped, Conversion)
|
||||
return httputils.METHOD_NOT_ALLOWED
|
||||
return httputils.bad_request("Conversion is not supported for collection type")
|
||||
|
||||
if Permissions is None:
|
||||
if ShareType == "token":
|
||||
@@ -1081,7 +1081,7 @@ class BaseSharing:
|
||||
for permission in Permissions:
|
||||
if permission not in "rPp":
|
||||
logger.warning(api_info + ": PathMapped=%r Permissions=%r not supported for Conversion=%r", PathMapped, Permissions, Conversion)
|
||||
return httputils.METHOD_NOT_ALLOWED
|
||||
return httputils.bad_request("Permissions are not supported for conversion")
|
||||
|
||||
if Enabled is None:
|
||||
Enabled = False # security by default
|
||||
@@ -1299,7 +1299,7 @@ class BaseSharing:
|
||||
for permission in Permissions:
|
||||
if permission not in "rPp":
|
||||
logger.warning(api_info + ": PathMapped=%r Permissions=%r not supported for Conversion=%r", PathMapped, Permissions, Conversion)
|
||||
return httputils.METHOD_NOT_ALLOWED
|
||||
return httputils.bad_request("Permissions are not supported for conversion")
|
||||
|
||||
if user == share['Owner']:
|
||||
if PathMapped is not None:
|
||||
|
||||
Reference in New Issue
Block a user