|
@@ -392,9 +392,10 @@
|
|
|
|
|
|
for(OCFileDto *itemDto in items) {
|
|
|
|
|
|
- NSString *serverUrl;
|
|
|
+ NSString *serverUrl, *directoryID;
|
|
|
+ BOOL isFolderEncrypted;
|
|
|
|
|
|
- NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
|
|
|
+ NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
|
|
|
|
|
|
// Skip hidden files
|
|
|
if (fileName.length > 0) {
|
|
@@ -414,28 +415,21 @@
|
|
|
}
|
|
|
// ------------------------
|
|
|
|
|
|
- NSRange firstInstance = [itemDto.filePath rangeOfString:[NSString stringWithFormat:@"%@/files/%@", dav, _activeUserID]];
|
|
|
- NSRange finalRange = NSMakeRange(firstInstance.location + firstInstance.length, itemDto.filePath.length-(firstInstance.location + firstInstance.length));
|
|
|
- if (finalRange.location != NSNotFound && finalRange.location + finalRange.length <= itemDto.filePath.length) {
|
|
|
- // It's safe to use range on str
|
|
|
- serverUrl = [itemDto.filePath substringWithRange:finalRange];
|
|
|
- } else {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- /* TRIM */
|
|
|
+ serverUrl = [itemDto.filePath stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@/files/%@", dav, _activeUserID] withString:@""];
|
|
|
if ([serverUrl hasPrefix:@"/"])
|
|
|
serverUrl = [serverUrl substringFromIndex:1];
|
|
|
if ([serverUrl hasSuffix:@"/"])
|
|
|
serverUrl = [serverUrl substringToIndex:[serverUrl length] - 1];
|
|
|
- /* ---- */
|
|
|
-
|
|
|
serverUrl = [CCUtility stringAppendServerUrl:[_activeUrl stringByAppendingString:webDAV] addFileName:serverUrl];
|
|
|
-
|
|
|
- NSString *directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:serverUrl].directoryID;
|
|
|
|
|
|
- BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:_metadataNet.account];
|
|
|
-
|
|
|
+ if (itemDto.isDirectory) {
|
|
|
+ isFolderEncrypted = itemDto.isEncrypted;
|
|
|
+ directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:isFolderEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:serverUrl].directoryID;
|
|
|
+ } else {
|
|
|
+ isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:_metadataNet.account];
|
|
|
+ directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrl];
|
|
|
+ }
|
|
|
+
|
|
|
[metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl directoryID:directoryID autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:_metadataNet.account directoryUser:directoryUser isFolderEncrypted:isFolderEncrypted]];
|
|
|
}
|
|
|
|
|
@@ -552,10 +546,10 @@
|
|
|
|
|
|
for(OCFileDto *itemDto in items) {
|
|
|
|
|
|
- NSString *serverUrl, *fileName, *directoryID;
|
|
|
+ NSString *serverUrl, *directoryID;
|
|
|
BOOL isFolderEncrypted;
|
|
|
|
|
|
- fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
|
|
|
+ NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
|
|
|
|
|
|
// Skip hidden files
|
|
|
if (fileName.length > 0) {
|
|
@@ -584,7 +578,7 @@
|
|
|
|
|
|
if (itemDto.isDirectory) {
|
|
|
isFolderEncrypted = itemDto.isEncrypted;
|
|
|
- directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:isFolderEncrypted favorite:true fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:serverUrl].directoryID;
|
|
|
+ directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:isFolderEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:serverUrl].directoryID;
|
|
|
} else {
|
|
|
isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:_metadataNet.account];
|
|
|
directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrl];
|