Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,16 @@ public void saveFolder(OCFile folder, Collection<OCFile> updatedFiles, Collectio
ContentValues cv = createContentValueForFile(file, folder);

if (fileExists(file.getFileId()) || fileExists(file.getRemotePath())) {
long fileId;
if (file.getFileId() != -1) {
fileId = file.getFileId();
} else {
fileId = getFileByPath(file.getRemotePath()).getFileId();
}
// updating an existing file
operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI)
.withValues(cv)
.withSelection(ProviderTableMeta._ID + "=?", new String[]{String.valueOf(file.getFileId())})
.withSelection(ProviderTableMeta._ID + "=?", new String[]{String.valueOf(fileId)})
.build());
} else {
// adding a new file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ private void synchronizeData(List<Object> folderAndFiles) {
// retrieve local data for the read file
localFile = localFilesMap.remove(remoteFile.getRemotePath());

if (localFile == null) {
localFile = mStorageManager.getFileByPath(updatedFile.getRemotePath());
}

// add to updatedFile data about LOCAL STATE (not existing in server)
updatedFile.setLastSyncDateForProperties(mCurrentSyncTime);

Expand Down