Skip to content

Commit

Permalink
#3221 fix: hypothetically leaking carriage return characters in headi…
Browse files Browse the repository at this point in the history
…ngs in note link dialog under Windows

Signed-off-by: Patrizio Bekerle <[email protected]>
  • Loading branch information
pbek committed Feb 1, 2025
1 parent 96b8510 commit 60044eb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## 25.2.0
- Added GDScript support to the note edit code block syntax highlighter
(for [#3222](https://github.com/pbek/QOwnNotes/issues/3222), thank you, @DarienMC)
- Try to fix hypothetically leaking carriage return characters in the headings in
the note link dialog under Windows (for [#3221](https://github.com/pbek/QOwnNotes/issues/3221))

## 25.1.7
- When inserting an image or attachment file via their insert dialogs or via
Expand Down
3 changes: 2 additions & 1 deletion src/dialogs/linkdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ Note LinkDialog::getSelectedNote() const {
}

QString LinkDialog::getSelectedHeading() const {
// Trim the heading text, in case there are trailing carriage return characters leaking in Windows
return ui->headingListWidget->selectedItems().isEmpty()
? ""
: ui->headingListWidget->currentItem()->text();
: ui->headingListWidget->currentItem()->text().trimmed();
}

QString LinkDialog::getURL() const {
Expand Down
3 changes: 2 additions & 1 deletion src/entities/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4265,7 +4265,8 @@ QStringList Note::getHeadingList() {

while (i.hasNext()) {
QRegularExpressionMatch match = i.next();
headingList << match.captured(1);
// Trim the heading text, in case there are trailing carriage return characters leaking in Windows
headingList << match.captured(1).trimmed();
}

return headingList;
Expand Down

0 comments on commit 60044eb

Please sign in to comment.