mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Fixed adding control characters at the end of url in bookmarks import
closes #499
This commit is contained in:
parent
0f98af2001
commit
119c23f630
|
@ -71,8 +71,8 @@ QList<BookmarksModel::Bookmark> ChromeImporter::exportBookmarks()
|
|||
parsedString = "(" + parsedString + ")";
|
||||
if (scriptEngine->canEvaluate(parsedString)) {
|
||||
QScriptValue object = scriptEngine->evaluate(parsedString);
|
||||
QString name = object.property("name").toString();
|
||||
QUrl url = QUrl::fromEncoded(object.property("url").toString().toUtf8());
|
||||
QString name = object.property("name").toString().trimmed();
|
||||
QUrl url = QUrl::fromEncoded(object.property("url").toString().trimmed().toUtf8());
|
||||
|
||||
if (name.isEmpty() || url.isEmpty()) {
|
||||
continue;
|
||||
|
|
|
@ -66,7 +66,6 @@ QList<BookmarksModel::Bookmark> HtmlImporter::exportBookmarks()
|
|||
QString bookmarks = QString::fromUtf8(m_file.readAll());
|
||||
m_file.close();
|
||||
|
||||
|
||||
// Converting tags to lower case -,-
|
||||
// For some reason Qt::CaseInsensitive is not everytime insensitive :-D
|
||||
|
||||
|
@ -106,7 +105,7 @@ QList<BookmarksModel::Bookmark> HtmlImporter::exportBookmarks()
|
|||
rx.indexIn(string);
|
||||
|
||||
// QString arguments = rx.cap(1);
|
||||
QString folderName = rx.cap(2);
|
||||
QString folderName = rx.cap(2).trimmed();
|
||||
|
||||
folders.append(folderName);
|
||||
|
||||
|
@ -127,13 +126,13 @@ QList<BookmarksModel::Bookmark> HtmlImporter::exportBookmarks()
|
|||
rx.indexIn(string);
|
||||
|
||||
QString arguments = rx.cap(1);
|
||||
QString linkName = rx.cap(2);
|
||||
QString linkName = rx.cap(2).trimmed();
|
||||
|
||||
QRegExp rx2("href=\"(.*)\"");
|
||||
rx2.setMinimal(true);
|
||||
rx2.indexIn(arguments);
|
||||
|
||||
QUrl url = QUrl::fromEncoded(rx2.cap(1).toUtf8());
|
||||
QUrl url = QUrl::fromEncoded(rx2.cap(1).trimmed().toUtf8());
|
||||
|
||||
start += posOfLink + rx.cap(0).size();
|
||||
|
||||
|
|
|
@ -61,11 +61,11 @@ QList<BookmarksModel::Bookmark> OperaImporter::exportBookmarks()
|
|||
QRegExp rx2("NAME=(.*)\\n");
|
||||
rx2.setMinimal(true);
|
||||
rx2.indexIn(string);
|
||||
QString name = rx2.cap(1);
|
||||
QString name = rx2.cap(1).trimmed();
|
||||
|
||||
rx2.setPattern("URL=(.*)\\n");
|
||||
rx2.indexIn(string);
|
||||
QUrl url = QUrl::fromEncoded(rx2.cap(1).toUtf8());
|
||||
QUrl url = QUrl::fromEncoded(rx2.cap(1).trimmed().toUtf8());
|
||||
|
||||
if (name.isEmpty() || url.isEmpty()) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue
Block a user