From 8b2728ec382565c5bd57148600e34740a3c3fe52 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 21 Dec 2012 17:38:19 +0100 Subject: QUrl::fromUserInput: fix for urls without a host. QUrl::fromUserInput("http://") was invalid, which doesn't make sense since QUrl("http://") is valid. Same for "smb:" which is actually even more a valid URL from a user's point of view. Change-Id: I371ac393d61b49499edf5adbbc2a90b426fe9e5d Reviewed-by: Marco Martin Reviewed-by: Thiago Macieira --- src/corelib/io/qurl.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 494caf60d5..2a439b3a7c 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3878,12 +3878,11 @@ QUrl QUrl::fromUserInput(const QString &userInput) QUrl url = QUrl(trimmedString, QUrl::TolerantMode); QUrl urlPrepended = QUrl(QStringLiteral("http://") + trimmedString, QUrl::TolerantMode); - // Check the most common case of a valid url with scheme and host + // Check the most common case of a valid url with a scheme // We check if the port would be valid by adding the scheme to handle the case host:port // where the host would be interpretted as the scheme if (url.isValid() && !url.scheme().isEmpty() - && (!url.host().isEmpty() || !url.path().isEmpty()) && urlPrepended.port() == -1) return adjustFtpPath(url); -- cgit v1.2.3