Bladeren bron

search api

Marino Faggiana 8 jaren geleden
bovenliggende
commit
b3e741feb7

+ 8 - 1
Libraries external/OCCommunicationLib/OCCommunicationLib/OCCommunication.m

@@ -623,7 +623,14 @@
         token = @"no token";
     }
     
-    fileName = [fileName encodeString:NSUTF8StringEncoding];
+    path = [NSString stringWithFormat:@"%@/remote.php/dav", path];
+    path = [path encodeString:NSUTF8StringEncoding];
+    
+    //fileName = [fileName stringByAppendingString:@"%25"];
+    
+    //fileName = [fileName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+    
+    //fileName = [fileName encodeString:NSUTF8StringEncoding];
     
     OCWebDAVClient *request = [OCWebDAVClient new];
     request = [self getRequestWithCredentials:request];

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

@@ -288,11 +288,10 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil];
     
-    NSString *body = [NSString stringWithFormat:@"<?xml version=\"1.0\"?><d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\"><d:basicsearch><d:select><d:prop><d:displayname/></d:prop></d:select><d:from><d:scope><d:href>/files/%@</d:href><d:depth>infinity</d:depth></d:scope></d:from><d:where><d:like><d:prop><d:displayname/></d:prop><d:literal>%@</d:literal></d:like></d:where></d:basicsearch></d:searchrequest>", user, fileName];
+    NSString *body = [NSString stringWithFormat:@"<?xml version=\"1.0\"?><d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\"><d:basicsearch><d:select><d:prop><oc:fileid/><d:getcontenttype/><d:getetag/><oc:size/></d:prop></d:select><d:from><d:scope><d:href>/files/%@</d:href><d:depth>infinity</d:depth></d:scope></d:from><d:where><d:like><d:prop><d:displayname/></d:prop><d:literal>%%%@%%</d:literal></d:like></d:where><d:orderby/></d:basicsearch></d:searchrequest>", user, fileName];
     
     [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
-    
-    [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
+    [request setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
     
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication withUserSessionToken:token success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];

+ 1 - 1
iOSClient/Actions/CCActions.swift

@@ -323,7 +323,7 @@ class CCActions: NSObject {
             
             metadataNet.action = actionSearch
             metadataNet.delegate = delegate
-            metadataNet.fileName = "%\(fileName)%"
+            metadataNet.fileName = fileName
             metadataNet.options = depth
             metadataNet.selector = selectorSearch
             metadataNet.serverUrl = serverUrl

+ 1 - 1
iOSClient/Networking/OCNetworking.m

@@ -426,7 +426,7 @@
     [communication setCredentialsWithUser:_activeUser andPassword:_activePassword];
     [communication setUserAgent:[CCUtility getUserAgent]];
     
-    [communication search:_metadataNet.serverUrl fileName:_metadataNet.fileName depth:_metadataNet.options withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
+    [communication search:_activeUrl 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];