|
@@ -276,41 +276,80 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
|
|
|
|
|
|
NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil];
|
|
|
|
|
|
- body = [NSString stringWithFormat: @""
|
|
|
- "<?xml version=\"1.0\"?>"
|
|
|
- "<d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
|
|
|
- "<d:basicsearch>"
|
|
|
- "<d:select>"
|
|
|
- "<d:prop>"
|
|
|
- "<d:getlastmodified />"
|
|
|
- "<d:getetag />"
|
|
|
- "<d:getcontenttype />"
|
|
|
- "<d:resourcetype/>"
|
|
|
- "<d:getcontentlength />"
|
|
|
- "<oc:fileid/>"
|
|
|
- "<oc:id/>"
|
|
|
- "<oc:permissions />"
|
|
|
- "<oc:size />"
|
|
|
- "<oc:favorite/>"
|
|
|
- "<nc:is-encrypted/>"
|
|
|
- "</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:getcontenttype/></d:prop>"
|
|
|
- //"<d:literal>image/%</d:literal>"
|
|
|
- "<d:prop><d:displayname/></d:prop>"
|
|
|
- "<d:literal>%@</d:literal>"
|
|
|
- "</d:like>"
|
|
|
- "</d:where>"
|
|
|
- "</d:basicsearch>"
|
|
|
- "</d:searchrequest>", userID, folder, fileName];
|
|
|
+ if (contentType) {
|
|
|
+
|
|
|
+ body = [NSString stringWithFormat: @""
|
|
|
+ "<?xml version=\"1.0\"?>"
|
|
|
+ "<d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
|
|
|
+ "<d:basicsearch>"
|
|
|
+ "<d:select>"
|
|
|
+ "<d:prop>"
|
|
|
+ "<d:getlastmodified />"
|
|
|
+ "<d:getetag />"
|
|
|
+ "<d:getcontenttype />"
|
|
|
+ "<d:resourcetype/>"
|
|
|
+ "<d:getcontentlength />"
|
|
|
+ "<oc:fileid/>"
|
|
|
+ "<oc:id/>"
|
|
|
+ "<oc:permissions />"
|
|
|
+ "<oc:size />"
|
|
|
+ "<oc:favorite/>"
|
|
|
+ "<nc:is-encrypted/>"
|
|
|
+ "</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:getcontenttype/></d:prop>"
|
|
|
+ "<d:literal>%@</d:literal>"
|
|
|
+ "</d:like>"
|
|
|
+ "</d:where>"
|
|
|
+ "</d:basicsearch>"
|
|
|
+ "</d:searchrequest>", userID, contentType];
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ body = [NSString stringWithFormat: @""
|
|
|
+ "<?xml version=\"1.0\"?>"
|
|
|
+ "<d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
|
|
|
+ "<d:basicsearch>"
|
|
|
+ "<d:select>"
|
|
|
+ "<d:prop>"
|
|
|
+ "<d:getlastmodified />"
|
|
|
+ "<d:getetag />"
|
|
|
+ "<d:getcontenttype />"
|
|
|
+ "<d:resourcetype/>"
|
|
|
+ "<d:getcontentlength />"
|
|
|
+ "<oc:fileid/>"
|
|
|
+ "<oc:id/>"
|
|
|
+ "<oc:permissions />"
|
|
|
+ "<oc:size />"
|
|
|
+ "<oc:favorite/>"
|
|
|
+ "<nc:is-encrypted/>"
|
|
|
+ "</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:getcontenttype/></d:prop>"
|
|
|
+ //"<d:literal>image/%</d:literal>"
|
|
|
+ "<d:prop><d:displayname/></d:prop>"
|
|
|
+ "<d:literal>%@</d:literal>"
|
|
|
+ "</d:like>"
|
|
|
+ "</d:where>"
|
|
|
+ "</d:basicsearch>"
|
|
|
+ "</d:searchrequest>", userID, folder, fileName];
|
|
|
+ }
|
|
|
|
|
|
[request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
|
|
|
[request setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
|