mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-11-27 20:36:49 -08:00
Fix history items losing entry CustomData (#13573)
* Fix history items losing entry CustomData Entry::beginUpdate() copied attributes, attachments and auto-type associations into the temporary history item but not CustomData, unlike clone() and copyDataFrom(). As a result every history item was created with empty CustomData, and restoring an entry from history wiped its CustomData, losing KeePassXC-Browser settings and other client metadata. Copy CustomData into the history item like the other components and add TestEntry::testHistoryItemCustomData covering creation and restore. Co-Authored-By: Claude Fable 5 <[email protected]> * Removed redundant code to ensure consistency --------- Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: Jonathan White <[email protected]>
This commit is contained in:
3 files changed
+29
-9
No files matched your search
+4
-9
@@ -1039,10 +1039,8 @@ Entry* Entry::clone(CloneFlags flags) const
|
||||
} else {
|
||||
entry->m_uuid = m_uuid;
|
||||
}
|
||||
entry->m_data = m_data;
|
||||
entry->m_customData->copyDataFrom(m_customData);
|
||||
entry->m_attributes->copyDataFrom(m_attributes);
|
||||
entry->m_attachments->copyDataFrom(m_attachments);
|
||||
entry->copyDataFrom(this);
|
||||
entry->setUpdateTimeinfo(false);
|
||||
|
||||
if (flags & CloneUserAsRef) {
|
||||
entry->m_attributes->set(EntryAttributes::UserNameKey,
|
||||
@@ -1101,12 +1099,9 @@ void Entry::beginUpdate()
|
||||
Q_ASSERT(m_tmpHistoryItem.isNull());
|
||||
|
||||
m_tmpHistoryItem.reset(new Entry());
|
||||
m_tmpHistoryItem->setUpdateTimeinfo(false);
|
||||
m_tmpHistoryItem->m_uuid = m_uuid;
|
||||
m_tmpHistoryItem->m_data = m_data;
|
||||
m_tmpHistoryItem->m_attributes->copyDataFrom(m_attributes);
|
||||
m_tmpHistoryItem->m_attachments->copyDataFrom(m_attachments);
|
||||
m_tmpHistoryItem->m_autoTypeAssociations->copyDataFrom(m_autoTypeAssociations);
|
||||
m_tmpHistoryItem->copyDataFrom(this);
|
||||
m_tmpHistoryItem->setUpdateTimeinfo(false);
|
||||
|
||||
m_modifiedSinceBegin = false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user