Skip to content

Commit d46a7f0

Browse files
committed
#3456 note: allow empty note files
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent 9b1c535 commit d46a7f0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# QOwnNotes Changelog
22

3+
## 26.2.0
4+
5+
- Empty note files are now allowed again and will only result in a warning in the log
6+
(for [#3456](https://github.com/pbek/QOwnNotes/issues/3456))
7+
38
## 26.1.15
49

510
- Fixed a regression where pressing `Ctrl + Space` to format a markdown table would show

src/entities/note.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,9 +2470,7 @@ void Note::createFromFile(QFile &file, int noteSubFolderId, bool withNoteNameHoo
24702470
// Check file size before reading - skip empty files as they might indicate corruption
24712471
const qint64 fileSize = fileInfo.size();
24722472
if (fileSize == 0) {
2473-
qWarning() << __func__ << " - Skipping empty file:" << file.fileName();
2474-
file.close();
2475-
return;
2473+
qWarning() << __func__ << " - Opened empty file:" << file.fileName();
24762474
}
24772475

24782476
QTextStream in(&file);
@@ -2485,7 +2483,7 @@ void Note::createFromFile(QFile &file, int noteSubFolderId, bool withNoteNameHoo
24852483
file.close();
24862484

24872485
// Verify that we actually read some content
2488-
if (noteText.isEmpty()) {
2486+
if (fileSize > 0 && noteText.isEmpty()) {
24892487
qWarning() << __func__ << " - Read empty text from file:" << file.fileName();
24902488
return;
24912489
}

0 commit comments

Comments
 (0)