Folio icon indicating copy to clipboard operation
Folio copied to clipboard

Notes getting wiped

Open ToxicStoxm opened this issue 8 months ago • 3 comments

General info

  • OS-Version: Fedora 42 Silverblue
  • App-Version: 25.02

Description

So I didn't figure out exactly how to reproduce it but it keeps happening to me since I use this app. I used Paper (which this is inspired by) and there, this didn't happen. I have about 5 or 6 different Notebooks with like 10 - 20 notes each. When using Folio, most of the time I create a new note, write something in it (normally for about 1 hour) and than save it with Ctrl+S (I have auto-saving disabled). Then I either close my laptop or just close the application or leave it open, depending if I still need it afterwards. Then sometimes after reopening the app, it just wipes the entire note I just wrote. If I search the file on disk, it is literally 0 Bytes. I saw a few other similar issues getting closed, that's why I waited with creating an issue myself, but sadly those fixes did not fix my problem. It just occurred again and I lost about an hour of work :(. I would appreciate if this gets fixed. Like I said, this doesn't happen on a regular basis but since it just happened to me again I thought I'll report it.

Sometimes I even saw like 2 random (unknown) Unicode symbols in the file after it got wiped, like it was just random data. When first opened all of my .md notes (which I had transferred from Paper) with Folio it just wiped half of them. Luckily I still had backups of that so I was just able to just copy the raw markdown text from Paper to new notes in Folio (I thought maybe the format wasn't completely compatible, even though it should because it's just markdown but anyways), since that point (so since switching to Folio) I've been dealing with getting my notes wiped on a regular basis.

I'll keep an eye open for when this exactly happens and will comment on this issue if I find out more about how to reproduce this. I wanted to add logs, but there don't seem to be any (please correct me if I'm wrong and just didn't find them).

If any additional infos is required I'm happy to answer questions.

ToxicStoxm avatar May 14 '25 13:05 ToxicStoxm

The note i just mentioned getting wiped, just reappeared after restarting Folio, I have really no idea how that works, considering that the actual .md file was 0 Bytes when I checked it.

ToxicStoxm avatar May 14 '25 13:05 ToxicStoxm

This is what I mean by random unknown Unicode symbols: Image

ToxicStoxm avatar May 14 '25 13:05 ToxicStoxm

If you can reproduce it I can probably track it down, it's probably another issue relating to saving when something else has changed, like the note name, etc.

The random garbage has been reported before but I've never found a way to create it consistently so no way to debug it at this point.

toolstack avatar May 14 '25 20:05 toolstack

The random garbage has been reported before but I've never found a way to create it consistently so no way to debug it at this point.

I noticed this too and did some testing. It looks to me like notes that do not end with a newline character may be displayed with garbage at the end. A wild guess is that some piece of code assumes that all notes (or lines) end in a newline character, and in cases where that assumption is not true, overshoots a string/buffer searching for one, returning whatever happens to be in memory there. Valgrind might help to pin it down.

I think Folio itself adds a newline at the end when saving, so such notes need to be created externally. It seems the Nextcloud Notes app for Android will not forcibly add a newline (probably the source for me). For testing, I'm just using e.g. echo -n test > test.md.

lawmurray avatar Aug 31 '25 11:08 lawmurray

On the garbage characters issue, I ran it through valgrind and think I found the issue. Submitted PR #283 to fix.

lawmurray avatar Sep 01 '25 03:09 lawmurray

The garbage issue has been resolved through #286 and the other mentioned issue hasn't been reproducible, so I'm going to close this item for now.

If there are any updates on reproducibility I'll reopen it.

toolstack avatar Oct 07 '25 00:10 toolstack