franciskafieh / obsidian-list-modified

🪨 The advanced and adaptive changelog for Obsidian. Links all modified files meeting certain criteria to a timed (daily, weekly, monthly) note.
MIT License
85 stars 7 forks source link

[BUG] File rename corrupts OLM data when "Automatically update internal links" is disabled #93

Open cotneit opened 2 months ago

cotneit commented 2 months ago

First Steps

Describe the bug

Renaming a file with "Automatically update internal links" disabled messes up the data written by OLM to daily note after renamed link. See repro section for more details.

Not an issue for files that have multiple links because after renaming a file, files that link to it are also modified, looks like it writes corrupted data on rename but then overrides with good data when files that link to the renamed file are modified.

Since modifying any file fixes the link in OLM, this is pretty much only an issue when triggered at the end of the day.

Expected behaviour

Shouldn't happen

Reproducing

My setup

Steps to reproduce bug

Can you pinpoint when/why this bug happens?

  1. Settings => Files and links => Disable "Automatically update internal links"
  2. Make sure either "Linked mentions" view is visible (not needed for repro but will help with understanding the problem)
  3. Create a new file OR Modify a file that has no links to it except the one in current daily note generated by OLM
  4. Rename the file so that filename length is different. When prompted with "Update links", don't click anything just yet
  5. Pay attention to "Linked mentions" view, at this point the link in daily note is renamed
  6. Click "Just once" when prompted with "Do you want to update internal links that link to this file?"
  7. Now the link in daily note is a bit messed up.

Additional info?

franciskafieh commented 1 week ago

Thanks for the super detailed bug report.

Since modifying any file fixes the link in OLM, this is pretty much only an issue when triggered at the end of the day.

Unless I am misunderstanding, the same logic when a file is modified is also ran at the end of a day, so it is odd that editing a file would fix this. I will look more into it when I have time, though

franciskafieh commented 1 week ago

@cotneit do you by chance have an interval set? in the plugin's data.json, there should be a writeInterval field. What does this number read?

cotneit commented 3 days ago

@franciskafieh writeInterval is set to 0

Unless I am misunderstanding, the same logic when a file is modified is also ran at the end of a day, so it is odd that editing a file would fix this. I will look more into it when I have time, though

Sorry, this being an issue at the end of the day was likely an assumption on my part, I don't think I actually tested that, I just noticed that a couple of my older daily notes looked weird so I assumed that's what happened.

franciskafieh commented 3 days ago

I will look into it when I have time, thank you for the update. Will be fixed before 3.0