Use QUrl::fromUserInput for utils.qurl
This commit is contained in:
parent
0648dce295
commit
210380e4b0
@ -17,7 +17,6 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
import platform
|
import platform
|
||||||
@ -35,10 +34,7 @@ def qurl(url):
|
|||||||
if isinstance(url, QUrl):
|
if isinstance(url, QUrl):
|
||||||
logging.debug("url is already a qurl")
|
logging.debug("url is already a qurl")
|
||||||
return url
|
return url
|
||||||
if not (re.match(r'^\w+://', url) or url.startswith('about:')):
|
newurl = QUrl.fromUserInput(url)
|
||||||
logging.debug("adding http:// to {}".format(url))
|
|
||||||
url = 'http://' + url
|
|
||||||
newurl = QUrl(url)
|
|
||||||
logging.debug('Converting {} to qurl -> {}'.format(url, newurl.url()))
|
logging.debug('Converting {} to qurl -> {}'.format(url, newurl.url()))
|
||||||
return newurl
|
return newurl
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user