summaryrefslogtreecommitdiffstats
path: root/api/logic/net
diff options
context:
space:
mode:
Diffstat (limited to 'api/logic/net')
-rw-r--r--api/logic/net/Download.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/api/logic/net/Download.cpp b/api/logic/net/Download.cpp
index fc634e3d..ccdc2c7d 100644
--- a/api/logic/net/Download.cpp
+++ b/api/logic/net/Download.cpp
@@ -167,14 +167,24 @@ bool Download::handleRedirect()
}
QString redirectStr = QString::fromUtf8(redirectBA);
- /*
- * IF the URL begins with //, we need to insert the URL scheme.
- * See: https://bugreports.qt-project.org/browse/QTBUG-41061
- */
if(redirectStr.startsWith("//"))
{
+ /*
+ * IF the URL begins with //, we need to insert the URL scheme.
+ * See: https://bugreports.qt.io/browse/QTBUG-41061
+ * See: http://tools.ietf.org/html/rfc3986#section-4.2
+ */
redirectStr = m_reply->url().scheme() + ":" + redirectStr;
}
+ else if(redirectStr.startsWith("/"))
+ {
+ /*
+ * IF the URL begins with /, we need to process it as a relative URL
+ */
+ auto url = m_reply->url();
+ url.setPath(redirectStr, QUrl::TolerantMode);
+ redirectStr = url.toString();
+ }
/*
* Next, make sure the URL is parsed in tolerant mode. Qt doesn't parse the location header in tolerant mode, which causes issues.