Skip to content

Commit 5399f6b

Browse files
committed
- OCConnection+Sharing: add handling of FORBIDDEN status code, leveraging JSON/OData error response parsing in case the response also contains JSON error information.
1 parent fa7f56f commit 5399f6b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

ownCloudSDK/Connection/OCConnection+Sharing.m

+15
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#import "OCShare+GraphAPI.h"
4949
#import "GASharingLink.h"
5050
#import "GASharingLinkPassword.h"
51+
#import "OCODataDecoder.h"
5152

5253
@implementation OCConnection (Sharing)
5354

@@ -703,6 +704,20 @@ - (void)_handleDeletePermissionResult:(OCHTTPRequest *)request error:(NSError *)
703704
event.error = OCError(OCErrorShareNotFound);
704705
break;
705706

707+
case OCHTTPStatusCodeFORBIDDEN:
708+
{
709+
NSDictionary* jsonObj = [request.httpResponse bodyConvertedDictionaryFromJSONWithError:NULL];
710+
if ((jsonObj != nil) && (jsonObj[@"error"] != nil))
711+
{
712+
OCODataResponse *response = [OCODataDecoder decodeODataResponse:jsonObj entityClass:Nil options:Nil];
713+
if (response.error != nil)
714+
{
715+
event.error = response.error;
716+
break;
717+
}
718+
}
719+
}
720+
706721
default:
707722
// Unknown error
708723
event.error = request.httpResponse.status.error;

0 commit comments

Comments
 (0)