Marino Faggiana 8 years ago
parent
commit
18d33d9b95

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

@@ -631,7 +631,7 @@
     OCWebDAVClient *request = [OCWebDAVClient new];
     request = [self getRequestWithCredentials:request];
     
-    [request search:path fileName:fileName depth:depth onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
+    [request search:path fileName:fileName depth:depth user:_user onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
         if (successRequest) {
             NSData *responseData = (NSData*) responseObject;
             

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

@@ -182,7 +182,7 @@ extern NSString * _Nullable OCWebDAVModificationDateKey;
 
 
 
-- (void)search:(NSString * _Nonnull)path fileName:(NSString * _Nonnull)fileName depth:(NSString * _Nonnull)depth
+- (void)search:(NSString * _Nonnull)path fileName:(NSString * _Nonnull)fileName depth:(NSString * _Nonnull)depth user:(NSString * _Nonnull)user
  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;

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

@@ -258,7 +258,7 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     [operation resume];
 }
 
-- (void)mr_search:(NSString *)path fileName:(NSString *)fileName depth:(NSString *)depth withUserSessionToken:(NSString*)token onCommunication:
+- (void)mr_search:(NSString *)path fileName:(NSString *)fileName depth:(NSString *)depth user:(NSString *)user withUserSessionToken:(NSString*)token onCommunication:
 (OCCommunication *)sharedOCCommunication
             success:(void(^)(NSHTTPURLResponse *operation, id response, NSString *token))success
             failure:(void(^)(NSHTTPURLResponse *response, id  _Nullable responseObject, NSError *, NSString *token))failure {
@@ -267,7 +267,7 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     _requestMethod = @"SEARCH";
     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>",@"admin",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><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];
     
     [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
     
@@ -299,11 +299,11 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     [self mr_listPath:path depth:1 withUserSessionToken:token onCommunication:sharedOCCommunication success:success failure:failure];
 }
 
-- (void)search:(NSString *)path fileName:(NSString *)fileName depth:(NSString *)depth
+- (void)search:(NSString *)path fileName:(NSString *)fileName depth:(NSString *)depth user:(NSString *)user
  onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token
          success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success
          failure:(void(^)(NSHTTPURLResponse *, id  _Nullable responseObject, NSError *, NSString *token))failure {
-    [self mr_search:path fileName:fileName depth:depth withUserSessionToken:token onCommunication:sharedOCCommunication success:success failure:failure];
+    [self mr_search:path fileName:fileName depth:depth user:user withUserSessionToken:token onCommunication:sharedOCCommunication success:success failure:failure];
 }
 
 - (NSURLSessionDownloadTask *)downloadWithSessionPath:(NSString *)remoteSource toPath:(NSString *)localDestination defaultPriority:(BOOL)defaultPriority onCommunication:(OCCommunication *)sharedOCCommunication progress:(void(^)(NSProgress *progress))downloadProgress success:(void(^)(NSURLResponse *response, NSURL *filePath))success failure:(void(^)(NSURLResponse *response, NSError *error))failure{

+ 1 - 1
iOSClient/Actions/CCActions.swift

@@ -312,7 +312,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