From 56b9546744e29107a55bc4d5990c7361e63f222b Mon Sep 17 00:00:00 2001 From: David Sansome Date: Thu, 15 Mar 2012 16:36:25 +0000 Subject: [PATCH] Assume URLs in podcast RSS feeds are already URL encoded --- src/podcasts/podcastparser.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/podcasts/podcastparser.cpp b/src/podcasts/podcastparser.cpp index 069aba697..ac51af84d 100644 --- a/src/podcasts/podcastparser.cpp +++ b/src/podcasts/podcastparser.cpp @@ -102,7 +102,7 @@ void PodcastParser::ParseChannel(QXmlStreamReader* reader, Podcast* ret) const { if (name == "title") { ret->set_title(reader->readElementText()); } else if (name == "link" && reader->namespaceUri().isEmpty()) { - ret->set_link(QUrl(reader->readElementText())); + ret->set_link(QUrl::fromEncoded(reader->readElementText().toAscii())); } else if (name == "description") { ret->set_description(reader->readElementText()); } else if (name == "owner" && reader->namespaceUri() == kItunesNamespace) { @@ -113,7 +113,7 @@ void PodcastParser::ParseChannel(QXmlStreamReader* reader, Podcast* ret) const { ret->set_copyright(reader->readElementText()); } else if (name == "link" && reader->namespaceUri() == kAtomNamespace && ret->url().isEmpty() && reader->attributes().value("rel") == "self") { - ret->set_url(QUrl(reader->readElementText())); + ret->set_url(QUrl::fromEncoded(reader->readElementText().toAscii())); } else if (name == "item") { ParseItem(reader, ret); } else { @@ -138,7 +138,7 @@ void PodcastParser::ParseImage(QXmlStreamReader* reader, Podcast* ret) const { case QXmlStreamReader::StartElement: { const QStringRef name = reader->name(); if (name == "url") { - ret->set_image_url_large(QUrl(reader->readElementText())); + ret->set_image_url_large(QUrl::fromEncoded(reader->readElementText().toAscii())); } else { Utilities::ConsumeCurrentElement(reader); } @@ -206,7 +206,7 @@ void PodcastParser::ParseItem(QXmlStreamReader* reader, Podcast* ret) const { } } else if (name == "enclosure") { if (reader->attributes().value("type").toString().startsWith("audio/")) { - episode.set_url(QUrl(reader->attributes().value("url").toString())); + episode.set_url(QUrl::fromEncoded(reader->attributes().value("url").toString().toAscii())); } Utilities::ConsumeCurrentElement(reader); } else if (name == "author" && reader->namespaceUri() == kItunesNamespace) { @@ -263,8 +263,8 @@ void PodcastParser::ParseOutline(QXmlStreamReader* reader, OpmlContainer* ret) c Podcast podcast; podcast.set_description(attributes.value("description").toString()); podcast.set_title(attributes.value("text").toString()); - podcast.set_image_url_large(QUrl(attributes.value("imageHref").toString())); - podcast.set_url(QUrl(attributes.value("xmlUrl").toString())); + podcast.set_image_url_large(QUrl::fromEncoded(attributes.value("imageHref").toString().toAscii())); + podcast.set_url(QUrl::fromEncoded(attributes.value("xmlUrl").toString().toAscii())); ret->feeds.append(podcast); // Consume any children and the EndElement.