mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 18:26:34 +01:00
OpenSearchReader: Fixed parsing files with XML declaration
This commit is contained in:
parent
d1f0b1776a
commit
605ce133e1
@ -26,6 +26,7 @@ Version 1.5.0
|
|||||||
* fixed: loading plugins with relative paths in portable build
|
* fixed: loading plugins with relative paths in portable build
|
||||||
* fixed: displaying a lot of RSS feeds in RSS widget in locationbar
|
* fixed: displaying a lot of RSS feeds in RSS widget in locationbar
|
||||||
* fixed: enabling disabled rules in AdBlock now works everytime
|
* fixed: enabling disabled rules in AdBlock now works everytime
|
||||||
|
* fixed: parsing OpenSearch files with XML declaration
|
||||||
|
|
||||||
Version 1.4.4
|
Version 1.4.4
|
||||||
* released 1 September 2013
|
* released 1 September 2013
|
||||||
|
@ -99,16 +99,29 @@ OpenSearchEngine* OpenSearchReader::read()
|
|||||||
OpenSearchEngine* engine = new OpenSearchEngine();
|
OpenSearchEngine* engine = new OpenSearchEngine();
|
||||||
m_searchXml = device()->peek(1024 * 5);
|
m_searchXml = device()->peek(1024 * 5);
|
||||||
|
|
||||||
while (!isStartElement() && !atEnd()) {
|
|
||||||
readNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_searchXml.contains(QLatin1String("http://a9.com/-/spec/opensearch/1.1/")) &&
|
if (!m_searchXml.contains(QLatin1String("http://a9.com/-/spec/opensearch/1.1/")) &&
|
||||||
!m_searchXml.contains(QLatin1String("http://www.mozilla.org/2006/browser/search/"))) {
|
!m_searchXml.contains(QLatin1String("http://www.mozilla.org/2006/browser/search/"))) {
|
||||||
raiseError(QObject::tr("The file is not an OpenSearch 1.1 file."));
|
raiseError(QObject::tr("The file is not an OpenSearch 1.1 file."));
|
||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// It just skips the XML declaration
|
||||||
|
// The parsing code bellow for some reason doesn't like it -,-
|
||||||
|
|
||||||
|
int index = m_searchXml.indexOf(QLatin1String("<?xml"));
|
||||||
|
if (index > 0) {
|
||||||
|
int end = m_searchXml.indexOf(QLatin1String("?>"), index);
|
||||||
|
|
||||||
|
if (end > 0) {
|
||||||
|
device()->read(end + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!isStartElement() && !atEnd()) {
|
||||||
|
readNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
while (!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user