if (fileExists(file.getRemotePath())) {
OCFile oldFile = getFileByPath(file.getRemotePath());
file.setFileId(oldFile.getFileId());
+
+ if (file.isDirectory()) {
+ cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, oldFile.getFileLength());
+ file.setFileLength(oldFile.getFileLength());
+ }
+
operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI).
withValues(cv).
withSelection( ProviderTableMeta._ID + "=?",
OCFile oldFile = getFileById(file.getFileId());
if (file.getStoragePath() == null && oldFile.getStoragePath() != null)
file.setStoragePath(oldFile.getStoragePath());
- if (!file.isDirectory());
- cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
-
+
+ if (!file.isDirectory())
+ cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
+ else {
+ cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, oldFile.getFileLength());
+ file.setFileLength(oldFile.getFileLength());
+ }
+
operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI).
withValues(cv).
withSelection( ProviderTableMeta._ID + "=?",
List<OCFile> children = synchFolderOp.getChildren();
fetchChildren(children); // beware of the 'hidden' recursion here!
+ sendStickyBroadcast(true, remotePath, null);
+
} else {
if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED) {
mSyncResult.stats.numAuthExceptions++;
fetchData(newFile.getRemotePath(), newFile.getFileId());
// Update folder size on DB
- getStorageManager().calculateFolderSize(newFile.getFileId());
+ getStorageManager().calculateFolderSize(newFile.getFileId());
}
}