jstaf / onedriver

A native Linux filesystem for Microsoft OneDrive
GNU General Public License v3.0
1.86k stars 91 forks source link

Version history is lost for updated files #319

Closed jmarcelo closed 8 months ago

jmarcelo commented 1 year ago

I've noticed that when a local file is updated, a text file for example, onedriver first deletes the old file from the OneDrive cloud storage account and then uploads the edited file as a new file.

This behavior does not seem ideal because it causes the file to lose the version history, and also ends up filling OneDrive's recycle bin.

Is it possible to onedriver to just upload the edited file to OneDrive as a revision over the actual file?

philmck commented 9 months ago

I've noticed the same thing. I lost some KeePassXC passwords due to bug #350 and tried to recover them using OneDrive version history, only to find they were lost as well due to this bug. :-(

jstaf commented 8 months ago

I'm not really sure I can change this due to the way the app was written. I'm going to close this out just because I don't think it's possible.

Unlike a sync client which just periodically syncs what's changed every X minutes, this app sends every single change you make to OneDrive, including some interesting saving behavior KeepassXC and Libreoffice have where it saves changes into a new file, then moves it on top of the old file, effectively deleting it. So to OneDrive, your original version of the file was actually deleted, and a brand-new one that happens to share the same file contents replaced it. This is why version history gets wiped.

For KeepassXC and LibreOffice, you can disable this saving behavior by disabling "safe saving" in the options menus - it might help keep the version history, but I haven't actually tried this out.

philmck commented 8 months ago

Thank you for investigating. In case it helps anyone else - I confirmed the KeePassXC behaviour and tried disabling "safe saving" but it didn't help, at least in the Linux version. The Windows version has different options that seem to work better. Neither version matches the documentation. The designations "safe" and "dangerous" are highly misleading - if anything they should be reversed, in my experience.

I'm still coping with the fallout from losing those KeePass entries. Even without the file version history in OneDrive, there should be a history of sorts in the recycle bin, which is worth investigating for anyone else who has been affected. Unfortunately though that only lasts for 30 days and it took me longer than that to notice some of the entries were missing. I have older backups of the database on my PC but hunting for those missing entries is like looking for a needle in a haystack now.

abraunegg commented 8 months ago

@philmck What sort of OneDrive account type are you using, and where does the directory actually sit online?

OneDrive Personal is a vastly different technology stack to OneDrive Business, as business account types heavily utilise SharePoint, and that comes with its own unique set of challenges. Further to this, if you are storing your data on a SharePoint Library, there are a bunch of other considerations and backend API nuances (SharePoint bugs) that need to be navigated through to ensure an upload is successful and file version history is saved.

Yes the way that KeePass saves files to a new file and deletes the old file is not ideal, but the combination of KeePass file saves and these OneDrive Business / SharePoint nuances could also be a contributing factor to the problem.

References:

philmck commented 8 months ago

I'm on OneDrive personal (Microsoft 365). My KeePassXC database is in the root directory of that account, with a KeeShare folder beside it.