KPEntryTemplates icon indicating copy to clipboard operation
KPEntryTemplates copied to clipboard

Save changes prompt despite no changes made during entry editing

Open jschof opened this issue 9 years ago • 8 comments

When you edit an entry with a template parent assigned and you click on the X button in the top right corner of the window you are prompted with

Do you want to save the changes you have made to this entry?

even though no changes were made. I tried doing the same without the plugin installed and the behaviour is NOT the same. You are only prompted when you actually make changes to the entry.

This happens consistently for an entry but does not happen for all entries.

I was able to reproduce the problem by creating a new database with a new template containing 2 fields and assigning that template to Sample Entry.

Unfortunately I was unable to attach the database in native or zipped formats so have put the database in Dropbox for you to look at. The database has no password.

After opening up the database, edit entry Sample Entry and click on the X button to see the prompt. Clicking on the Cancel button exits the windows gracefully.

If you have any difficulties reproducing the problem or have any questions please let me know.

Cheers!

jschof avatar Jun 14 '17 01:06 jschof

I tested it with KP 2.35 and KPEntryTemplate 7.1, using a Parent-Template made with the Plugin KPET. Result: I am only prompted, when I maked changes to the entry. That would mean, that little fault is new, as jschof tested in KP 2.36 in liaison with KPET 7.3.

Stonebiter avatar Jun 14 '17 04:06 Stonebiter

Looks like it has something to do with the field value comparison for the "new fields" now available to the entry as a result of assigning the parent template.

I exported the DB to KeePass XML (2.x) format before editing an entry and then afterwards when I said to save the changes (even though I had made none). I then compared the XML to see what the differences were.

The entry saved the new fields with empty values:

<String>
	<Key>Field A</Key>
	<Value />
</String>
<String>
	<Key>Field B</Key>
	<Value />
</String>

And the historical records (yes, for some reason there are 2 identical ones) are saved without Fields A and B.

HTH

jschof avatar Jun 14 '17 12:06 jschof

I have not been able to duplicate this issue on my system. I have checked Keepass 2.34, 2.35 & 2.36 and none of my entries show a change by clicking the X if nothing has changed. Versions 2.34 & 2.35 are running KPET 7.3 and 2.36 is running KPET 7.5.

Wild13c avatar Jun 14 '17 12:06 Wild13c

Don't know if it makes a difference but I am using the portable version of Keepass.

I re-downloaded the portable app and plugin, created a new DB, template, assigned the template and immediately ran into the issue.

I have put a 1 minute video on Dropbox for you to see the issue.

Are you testing using a new DB or an existing one? I find that once an entry is assigned a template and saved, the new fields are saved to the entry so subsequent editing of the entry there is no longer a prompt when closing the window (after not having made any changes).

jschof avatar Jun 14 '17 14:06 jschof

@jschof I downloaded your sample, and found largely what you found when you exported it (you can more easily see the fields don't exist initially just by right clicking and clicking copy string (Field A and Field B will not be present). If I go right click Add New Entry entry, then set template parent, Field A and Field B are created. If I click the key drop down and click the template to create a new entry that way instead both Field A and Field B are created.

I believe what you did is this: You had one or more entries, instead of the entry having the template parent assigned to it like above, instead you right clicked on the entry and click "Set Template Parent" and selected the template that way. All this does is assign the parent template ID it does not init any of the fields on the entry. On first open the fields are set and this causes the prompt you see.

I don't have a problem with this behavior as: A) No matter if you save changes or don't save changes it will not hurt anything. B) This only happens (as far as I can tell) in the explicit creation case #3 that I put out above, and I am not sure it is super common. C) It only happens on first launch, once you save any changes it is fixed on the entry for life. D) This is not a new behavior, I verified it behaves the exact same (using your sample no less) in KeePass 2.30.

mitchcapper avatar Jun 14 '17 15:06 mitchcapper

To confirm this could be improved to meet what you are expecting I am just not sure it is worth the labor to do so given the fact it is the first time anyone has ever mentioned it and it has operated this way since the beginning.

mitchcapper avatar Jun 14 '17 15:06 mitchcapper

I agree it is probably not worth investigating further.

I was able to go through and "update" all my entries in less than 30 minutes which I did not out of necessity but simply because when I see that prompt I want to know that it is because something changed that I should probably be aware of.

I hadn't really noticed the key dropdown so thanks for that, will use it in the future.

I haven't been able to pin-point what exactly triggers this. The initial entry creation and template assignment is an easy one to reproduce and understand. I ran into many other instances though in my own DB where the template was already assigned and still I got prompted.

The only other side-effect I see from this (which really is a non-issue) is the creation of a bogus historical entry.

Thanks for quickly looking into this and for the turnaround time in supporting KP 2.36!

jschof avatar Jun 14 '17 17:06 jschof

@jschof another reason you may be seeing it is if you update the template. Updating the template does not change any entries when you update the template, they only update on the first re-open of the entry. This is again by design, otherwise if you made a typo or updates to the template all entries would have old data field left behind.

mitchcapper avatar Jun 14 '17 19:06 mitchcapper