Marino Faggiana 8 жил өмнө
parent
commit
9a8731d53f

+ 1 - 1
Libraries external/OCCommunicationLib/OCCommunicationLib/OCCommunication.h

@@ -470,7 +470,7 @@ typedef enum {
 /// @name Setting favorite
 ///-----------------------------------
 
-- (void)settingFavoriteServer:(NSString *)serverPath andFileOrFolderPath:(NSString *)filePath favorite:(BOOL)favorite withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
+- (void)settingFavoriteServer:(NSString *)path andFileOrFolderPath:(NSString *)filePath favorite:(BOOL)favorite withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
 
 
 #pragma mark - OC API Calls

+ 4 - 5
Libraries external/OCCommunicationLib/OCCommunicationLib/OCCommunication.m

@@ -624,7 +624,6 @@
         token = @"no token";
     }
     
-    path = [NSString stringWithFormat:@"%@/remote.php/dav", path];
     path = [path encodeString:NSUTF8StringEncoding];
     
     OCWebDAVClient *request = [OCWebDAVClient new];
@@ -653,19 +652,19 @@
 ///-----------------------------------
 /// @name Setting favorite
 ///-----------------------------------
-- (void)settingFavoriteServer:(NSString *)serverPath andFileOrFolderPath:(NSString *)filePath favorite:(BOOL)favorite withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest {
+- (void)settingFavoriteServer:(NSString *)path andFileOrFolderPath:(NSString *)filePath favorite:(BOOL)favorite withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest {
     
     if (!token){
         token = @"no token";
     }
     
-    serverPath = [NSString stringWithFormat:@"%@/remote.php/dav/files/%@/%@", serverPath, _user, filePath];
-    serverPath = [serverPath encodeString:NSUTF8StringEncoding];
+    path = [NSString stringWithFormat:@"%@/files/%@/%@", path, _user, filePath];
+    path = [path encodeString:NSUTF8StringEncoding];
     
     OCWebDAVClient *request = [OCWebDAVClient new];
     request = [self getRequestWithCredentials:request];
     
-    [request settingFavorite:serverPath favorite:favorite onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
+    [request settingFavorite:path favorite:favorite onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
         
         if (successRequest) {
             //Return success

+ 1 - 1
Libraries external/OCCommunicationLib/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h

@@ -190,7 +190,7 @@ extern NSString * _Nullable OCWebDAVModificationDateKey;
  
  */
 
-- (void)settingFavorite:(NSString * _Nonnull)serverFilePath favorite:(BOOL)favorite onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication withUserSessionToken:(NSString * _Nonnull)token success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id  _Nonnull, NSString * _Nonnull token))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id  _Nullable responseObject, NSError * _Nonnull, NSString * _Nonnull token))failure;
+- (void)settingFavorite:(NSString * _Nonnull)path favorite:(BOOL)favorite onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication withUserSessionToken:(NSString * _Nonnull)token success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id  _Nonnull, NSString * _Nonnull token))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id  _Nullable responseObject, NSError * _Nonnull, NSString * _Nonnull token))failure;
 
 /**
  Creates an `NSURLSessionDownloadTask` with the specified request for a local file.

+ 2 - 2
Libraries external/OCCommunicationLib/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -307,13 +307,13 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     [operation resume];
 }
 
-- (void)settingFavorite:(NSString * _Nonnull)serverFilePath favorite:(BOOL)favorite onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success failure:(void(^)(NSHTTPURLResponse *, id  _Nullable responseObject, NSError *, NSString *token))failure {
+- (void)settingFavorite:(NSString * _Nonnull)path favorite:(BOOL)favorite onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success failure:(void(^)(NSHTTPURLResponse *, id  _Nullable responseObject, NSError *, NSString *token))failure {
     
     NSParameterAssert(success);
     
     _requestMethod = @"PROPPATCH";
     
-    NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:serverFilePath parameters:nil];
+    NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil];
     
     NSString *body = [NSString stringWithFormat:@"<?xml version=\"1.0\"?><d:propertyupdate xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\"><d:set><d:prop><oc:favorite>%i</oc:favorite></d:prop></d:set></d:propertyupdate>", (favorite ? 1 : 0)];
                       

+ 1 - 0
iOSClient/CCGlobal.h

@@ -30,6 +30,7 @@ extern NSString *const appDatabase;
 extern NSString *const appCertificates;
 
 extern NSString *const webDAV;
+extern NSString *const dav;
 
 extern NSString *const appKeyCryptoCloud;
 extern NSString *const appSecretCryptoCloud;

+ 2 - 1
iOSClient/CCGlobal.m

@@ -28,8 +28,9 @@ NSString *const appApplicationSupport = @"Library/Application Support";
 NSString *const appDatabase = @"Library/Application Support/Crypto Cloud";
 NSString *const appCertificates = @"Library/Application Support/Certificates";
 
-// DAV
+// webDAV & DAV
 NSString *const webDAV = @"/remote.php/webdav";
+NSString *const dav = @"/remote.php/dav";
 
 // BKPasscode
 NSString *const BKPasscodeKeychainServiceName = @"Crypto Cloud";

+ 7 - 3
iOSClient/Networking/OCNetworking.m

@@ -426,7 +426,9 @@
     [communication setCredentialsWithUser:_activeUser andPassword:_activePassword];
     [communication setUserAgent:[CCUtility getUserAgent]];
     
-    [communication search:_activeUrl fileName:_metadataNet.fileName depth:_metadataNet.options withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
+    NSString *path = [_activeUrl stringByAppendingString:dav];
+    
+    [communication search:path fileName:_metadataNet.fileName depth:_metadataNet.options withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
         
         if ([self.delegate respondsToSelector:@selector(searchSuccess:metadatas:)])
             [self.delegate searchSuccess:_metadataNet metadatas:nil];
@@ -460,8 +462,10 @@
     
     [communication setCredentialsWithUser:_activeUser andPassword:_activePassword];
     [communication setUserAgent:[CCUtility getUserAgent]];
-        
-    [communication settingFavoriteServer:_activeUrl andFileOrFolderPath:_metadataNet.fileName favorite:[_metadataNet.options boolValue] withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token) {
+    
+    NSString *path = [_activeUrl stringByAppendingString:dav];
+
+    [communication settingFavoriteServer:path andFileOrFolderPath:_metadataNet.fileName favorite:[_metadataNet.options boolValue] withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token) {
         
         if ([self.delegate respondsToSelector:@selector(settingFavoriteSuccess:)])
             [self.delegate settingFavoriteSuccess:_metadataNet];