marinofaggiana 5 лет назад
Родитель
Сommit
2371ae3414

+ 1 - 1
File Provider Extension/FileProviderEnumerator.swift

@@ -147,7 +147,7 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
                     
                     if fileProviderData.sharedInstance.listServerUrlEtag[serverUrl] == nil || fileProviderData.sharedInstance.listServerUrlEtag[serverUrl] != metadata!.etag || metadatasFromDB == nil {
                         
-                        OCNetworking.sharedManager()?.search(withAccount: fileProviderData.sharedInstance.account, folder: "", startWith: "a", serverUrl: fileProviderData.sharedInstance.accountUrl, dateLastModified: nil, numberOfItem: 2, completion: { (account, metadatas, message, errorCode) in
+                        OCNetworking.sharedManager()?.search(withAccount: fileProviderData.sharedInstance.account, folderPath: serverUrl, startWith:"", dateLastModified: nil, numberOfItem: 2, completion: { (account, metadatas, message, errorCode) in
                             print(message ?? "NO MESSAGE")
                         })
                         

+ 1 - 3
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -441,7 +441,7 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
                     "<d:from>"
                         "<d:scope>"
                             "<d:href>/files/%@%@</d:href>"
-                            "<d:depth>0</d:depth>"
+                            "<d:depth>1</d:depth>"
                         "</d:scope>"
                     "</d:from>"
                     "<d:orderby>"
@@ -460,11 +460,9 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
                             "<d:literal>%@</d:literal>"
                         "</d:gte>"
                     "</d:or></d:and></d:where>"
-            
                     "<d:limit>"
                         "<d:nresults>%@</d:nresults>"
                     "</d:limit>"
-            
                 "</d:basicsearch>"
                 "</d:searchrequest>"
     ,userID, folderStartWith, dateLastModified, [@(numberOfItem) stringValue]];

+ 1 - 1
iOSClient/Networking/OCNetworking.h

@@ -54,7 +54,7 @@
 - (void)deleteFileOrFolderWithAccount:(NSString *)account path:(NSString *)path completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion;
 - (void)moveFileOrFolderWithAccount:(NSString *)account fileName:(NSString *)fileName fileNameTo:(NSString *)fileNameTo completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion;
 - (void)searchWithAccount:(NSString *)account fileName:(NSString *)fileName serverUrl:(NSString *)serverUrl contentType:(NSArray *)contentType lteDateLastModified:(NSDate *)lteDateLastModified gteDateLastModified:(NSDate *)gteDateLastModified depth:(NSString *)depth completion:(void(^)(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode))completion;
-- (void)searchWithAccount:(NSString *)account folder:(NSString *)folder startWith:(NSString *)startWith serverUrl:(NSString *)serverUrl dateLastModified:(NSDate *)dateLastModified numberOfItem:(NSInteger)numberOfItem completion:(void(^)(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode))completion;
+- (void)searchWithAccount:(NSString *)account folderPath:(NSString *)folderPath startWith:(NSString *)startWith dateLastModified:(NSDate *)dateLastModified numberOfItem:(NSInteger)numberOfItem completion:(void(^)(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode))completion;
 
 #pragma mark ===== downloadPreview =====
 

+ 4 - 2
iOSClient/Networking/OCNetworking.m

@@ -961,7 +961,7 @@
     }];
 }
 
-- (void)searchWithAccount:(NSString *)account folder:(NSString *)folder startWith:(NSString *)startWith serverUrl:(NSString *)serverUrl dateLastModified:(NSDate *)dateLastModified numberOfItem:(NSInteger)numberOfItem completion:(void(^)(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode))completion
+- (void)searchWithAccount:(NSString *)account folderPath:(NSString *)folderPath startWith:(NSString *)startWith dateLastModified:(NSDate *)dateLastModified numberOfItem:(NSInteger)numberOfItem completion:(void(^)(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode))completion
 {
     tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
     if (tableAccount == nil) {
@@ -973,7 +973,9 @@
     }
     
     NSString *path = [tableAccount.url stringByAppendingString:k_dav];
-    NSString *folderStartWith = @""; //[serverUrl stringByReplacingOccurrencesOfString:[CCUtility getHomeServerUrlActiveUrl:tableAccount.url] withString:@""];
+    NSString *folderStartWith = [folderPath stringByReplacingOccurrencesOfString:[CCUtility getHomeServerUrlActiveUrl:tableAccount.url] withString:@""];
+    folderStartWith = [NSString stringWithFormat:@"%@/%@", folderStartWith, startWith];
+    folderStartWith = [folderStartWith stringByAppendingString:@"%"];
     
     NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
     NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];