Skip to content

Commit

Permalink
#2858 evernote: handle malformed XML
Browse files Browse the repository at this point in the history
  • Loading branch information
pbek committed Sep 24, 2023
1 parent cf7d923 commit a05d84b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# QOwnNotes Changelog

## 23.9.7
- Evernote notes with malformed XML will now stop the import process when importing
them in the Evernote import (for [#2858](https://github.com/pbek/QOwnNotes/issues/2858))

## 23.9.6
- an issue with duplicate imported media files and attachments when importing notes
from Evernote was fixed (for [#2859](https://github.com/pbek/QOwnNotes/issues/2859))
Expand Down
9 changes: 9 additions & 0 deletions src/dialogs/evernoteimportdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <entities/notesubfolder.h>
#include <entities/tag.h>
#include <utils/misc.h>
#include <utils/gui.h>

#include <QCryptographicHash>
#include <QDebug>
Expand Down Expand Up @@ -180,6 +181,14 @@ Note EvernoteImportDialog::parseNote(QXmlStreamReader &xml, bool importMetaData)
parseMetaDataItem(xml);
}
}
} else if (xml.tokenType() == QXmlStreamReader::Invalid) {
// Stop parsing on invalid tokens
// See: https://github.com/pbek/QOwnNotes/issues/2858
Utils::Gui::warning(this, tr("Invalid XML!"),
tr("Invalid XML found in note <b>%1</b>! The import might be stopped at this point.")
.arg(title),
"evernote-import-invalid-xml");
break;
}

xml.readNext();
Expand Down
54 changes: 32 additions & 22 deletions src/languages/QOwnNotes_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,112 +757,122 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="66"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="67"/>
<source>Enex files</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="67"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="68"/>
<source>Select Evernote enex file to import</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="272"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="189"/>
<source>Invalid XML!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="190"/>
<source>Invalid XML found in note &lt;b&gt;%1&lt;/b&gt;! The import might be stopped at this point.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="294"/>
<source>Basic attributes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="273"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="295"/>
<source>Created date</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="274"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="296"/>
<source>Updated date</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="276"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="298"/>
<source>Note attributes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="277"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="299"/>
<source>Subject date</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="279"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="301"/>
<source>Latitude</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="281"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="303"/>
<source>Longitude</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="283"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="305"/>
<source>Altitude</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="285"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="307"/>
<source>Author</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="287"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="309"/>
<source>Source</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="289"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="311"/>
<source>Source URL</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="291"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="313"/>
<source>Source application</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="294"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="316"/>
<source>Reminder order</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="296"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="318"/>
<source>Reminder time</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="298"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="320"/>
<source>Reminder done time</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="301"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="323"/>
<source>Place name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="303"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="325"/>
<source>Content class</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="305"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="327"/>
<source>Application data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="705"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="727"/>
<source>Attribute</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/evernoteimportdialog.cpp" line="705"/>
<location filename="../dialogs/evernoteimportdialog.cpp" line="727"/>
<source>Value</source>
<translation type="unfinished"></translation>
</message>
Expand Down

0 comments on commit a05d84b

Please sign in to comment.