giuspen / cherrytree

cherrytree
https://www.giuspen.net/cherrytree/
Other
3.29k stars 457 forks source link

Deleted ctx-File after "Save as" dialog #2504

Closed DarthtidusX closed 1 month ago

DarthtidusX commented 1 month ago

Version 1.1.2, Operative system Windows 11 Enterprise State the Version and the Operative System/Desktop. Try the latest available version before reporting an issue.

Describe the bug When I tried to save my content via "save as" dialog I become an error --> see picture.

The old file were delete but the new file not created.

To Reproduce If applicable, attach a non-personal document where the issue can be reproduced systematically. Steps to reproduce the behavior:

  1. Go to File.'
  2. Click on 'Save as'
  3. Click on 'Single SQLite File, 7-zip Encrypted and Password Protected (.ctx)'
  4. Set new Password
  5. Save to network storage
  6. Delete old File
  7. Get the Error !! sqlite3 .... table node already exists

Screenshots

cherrytreeBug

giuspen commented 1 month ago

You did file--save_as of a .ctx choosing the exact same file path/name of the existing document you are currently saving, and that causes the issue, is that correct? I will try to reproduce and get back.

DarthtidusX commented 1 month ago

Hi,

yes that's the issue. Okay, let me know If you have news. Thank you.

giuspen commented 1 month ago

I see it, thanks for reporting I will come back with a fix shortly

[2024-05-07 22:07:54.558] [   ] [error] fs::remove: g_remove failed to remove C:\msys64\tmp\.9JB2M2\bug2.ctb
[2024-05-07 22:07:54.559] [   ] [error] fs::remove: g_remove failed to remove C:\msys64\tmp\.9JB2M2\bug2.ctb
[2024-05-07 22:07:54.559] [   ] [error] !! sqlite3 'CREATE TABLE node (node_id INTEGER UNIQUE,name TEXT,txt TEXT,syntax TEXT,tags TEXT,is_ro INTEGER,is_richtxt INTEGER,has_codebox INTEGER,has_table INTEGER,has_image INTEGER,level INTEGER,ts_creation INTEGER,ts_lastsave INTEGER)': table node already exists
DarthtidusX commented 1 month ago

No Problem. Thank you.

giuspen commented 1 month ago

Thanks again for reporting. I have now added checks and a warning dialog preventing a 'Save As' or 'Export' resulting in the overwrite of the currently open document. Running 'Save' is the only supported way to update the open document in place.

DarthtidusX commented 1 month ago

Oh nice. Thanks for fixing the issue. Have a nice weekend.

giuspen commented 1 month ago

Have a good weekend ;)