mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Merge pull request #4647 from nextcloud/fixVanishingImages
Fix vanishing images
This commit is contained in:
commit
af7bf9b2f7
2 changed files with 11 additions and 1 deletions
|
@ -343,10 +343,16 @@ public class FileDataStorageManager {
|
||||||
ContentValues cv = createContentValueForFile(file, folder);
|
ContentValues cv = createContentValueForFile(file, folder);
|
||||||
|
|
||||||
if (fileExists(file.getFileId()) || fileExists(file.getRemotePath())) {
|
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
|
// updating an existing file
|
||||||
operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI)
|
operations.add(ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI)
|
||||||
.withValues(cv)
|
.withValues(cv)
|
||||||
.withSelection(ProviderTableMeta._ID + "=?", new String[]{String.valueOf(file.getFileId())})
|
.withSelection(ProviderTableMeta._ID + "=?", new String[]{String.valueOf(fileId)})
|
||||||
.build());
|
.build());
|
||||||
} else {
|
} else {
|
||||||
// adding a new file
|
// adding a new file
|
||||||
|
|
|
@ -416,6 +416,10 @@ public class RefreshFolderOperation extends RemoteOperation {
|
||||||
// retrieve local data for the read file
|
// retrieve local data for the read file
|
||||||
localFile = localFilesMap.remove(remoteFile.getRemotePath());
|
localFile = localFilesMap.remove(remoteFile.getRemotePath());
|
||||||
|
|
||||||
|
if (localFile == null) {
|
||||||
|
localFile = mStorageManager.getFileByPath(updatedFile.getRemotePath());
|
||||||
|
}
|
||||||
|
|
||||||
// add to updatedFile data about LOCAL STATE (not existing in server)
|
// add to updatedFile data about LOCAL STATE (not existing in server)
|
||||||
updatedFile.setLastSyncDateForProperties(mCurrentSyncTime);
|
updatedFile.setLastSyncDateForProperties(mCurrentSyncTime);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue