mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Fix recursive directory metadata renaming order
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
9cc05457c0
commit
02e1d6a47f
1 changed files with 7 additions and 6 deletions
|
@ -199,6 +199,13 @@ class NextcloudFilesDatabaseManager : NSObject {
|
||||||
let metadatasToAdd = Array(metadatasToUpdate.map { NextcloudItemMetadataTable(value: $0) }) +
|
let metadatasToAdd = Array(metadatasToUpdate.map { NextcloudItemMetadataTable(value: $0) }) +
|
||||||
Array(metadatasToCreate.map { NextcloudItemMetadataTable(value: $0) })
|
Array(metadatasToCreate.map { NextcloudItemMetadataTable(value: $0) })
|
||||||
|
|
||||||
|
for metadata in directoriesNeedingRename {
|
||||||
|
|
||||||
|
if let updatedDirectoryChildren = renameDirectoryAndPropagateToChildren(ocId: metadata.ocId, newServerUrl: metadata.serverUrl, newFileName: metadata.fileName) {
|
||||||
|
metadatasToUpdate += updatedDirectoryChildren
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try database.write {
|
try database.write {
|
||||||
for metadata in metadatasToDelete {
|
for metadata in metadatasToDelete {
|
||||||
// Can't pass copies, we need the originals from the database
|
// Can't pass copies, we need the originals from the database
|
||||||
|
@ -211,12 +218,6 @@ class NextcloudFilesDatabaseManager : NSObject {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for metadata in directoriesNeedingRename {
|
|
||||||
if let updatedDirectoryChildren = renameDirectoryAndPropagateToChildren(ocId: metadata.ocId, newServerUrl: metadata.serverUrl, newFileName: metadata.fileName) {
|
|
||||||
metadatasToUpdate += updatedDirectoryChildren
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (newMetadatas: metadatasToCreate, updatedMetadatas: metadatasToUpdate, deletedMetadatas: metadatasToDelete)
|
return (newMetadatas: metadatasToCreate, updatedMetadatas: metadatasToUpdate, deletedMetadatas: metadatasToDelete)
|
||||||
} catch let error {
|
} catch let error {
|
||||||
Logger.ncFilesDatabase.error("Could not update any item metadatas, received error: \(error.localizedDescription, privacy: .public)")
|
Logger.ncFilesDatabase.error("Could not update any item metadatas, received error: \(error.localizedDescription, privacy: .public)")
|
||||||
|
|
Loading…
Reference in a new issue