summaryrefslogtreecommitdiff
path: root/qutebrowser/utils/urlutils.py
AgeCommit message (Collapse)Author
2021-12-03pylint: Enable else-if-usedpylint-2-12Florian Bruhin
2021-04-09make _widened_hostnames public, move to urlutilsAnder Punnar
2021-01-26doc: Switch URLs to httpsFlorian Bruhin
2021-01-20Bump copyright yearsFlorian Bruhin
Closes #6015
2021-01-05Add overrides for mimetype -> extension conversionFlorian Bruhin
Python 3.6 gets some of those "wrong": https://bugs.python.org/issue1043134 This has been fixed in Python 3.7: https://github.com/python/cpython/pull/14375 The override dict has been generated by copying the types_map from the current git master: https://github.com/python/cpython/blob/v3.10.0a3/Lib/mimetypes.py#L414-L547 And then running the following with Python 3.6: import mimetypes reverse = {} for ext, mimetype in types_map.items(): if mimetype not in reverse: reverse[mimetype] = ext assert reverse['text/plain'] == '.txt' for mimetype, ext in reverse.items(): got = mimetypes.guess_extension(mimetype) if got != ext: print(f' "{mimetype}": "{ext}", # not {got}')
2021-01-05Remove custom data: URL parsingFlorian Bruhin
Argh. I should've known Python can do this, but I didn't notice (or forget?) and wrote code - some 140 lines of it - which only was in this repository for a couple of hours. Oh well, good riddance, code which was replaced by a simple "mimetypes.guess_type(url.toString())". May you be resurrected if we ever need a proper data: URL parser at a later point. I guess some lessons have to be learned the hard way...
2021-01-04urlutils: Handle data URLs in filename_from_urlFlorian Bruhin
2021-01-04urlutils: Add fallback to filename_from_urlFlorian Bruhin
This makes the callers a bit simpler because they don't need to take care of falling back themselves.
2021-01-04urlutils: Add basic parsing of data: URLsFlorian Bruhin
2020-11-23urlutils: Consider scheme/port for same_domain()Florian Bruhin
See #5892
2020-11-04old qt: Get rid of qurl_from_user_inputFlorian Bruhin
2020-11-04old qt: Remove urlutils.query_stringFlorian Bruhin
2020-11-04old qt: Remove handling for unparseable URLsFlorian Bruhin
2020-10-29mypy: use from-import for typing in `utils`Tim Brown
See #5396
2020-09-05Fix mypyFlorian Bruhin
2020-09-05Use URL string for parse_javascript_urlFlorian Bruhin
The previous approach converted "javascript:///" to "/" as Qt only sets an internal "hasAuthority" flag, but we can't actually know whether an (empty) authority is present or not. However, QUrl doesn't let us get a FullyDecoded string because the value could be ambiguous - instead, we get the FullyEncoded variant now, and decode it via Python's urllib.parse. This seems to fix the /// corner case, and also is much closer to the standard.
2020-08-11Add :jseval --urlFlorian Bruhin
See #221
2020-06-17Break long conditional over 2 lines (fix pylint error)Jethro Cao
2020-06-17Add check for space character for schemeless modeJethro Cao
* this catches the edge case of urlstr w/ valid schemes, but contain space(s), such urlstr should be treated as non-URLs * e.g. "site:cookies.com oatmeal raisin" should be auto-searched
2020-06-17Rename new auto_search mode for less ambiguityJethro Cao
* no-url-scheme -> schemeless * improve message to log.url.debug
2020-06-17Add: new mode for Auto SearchJethro Cao
* when `url.auto_search = 'no-url-scheme'`, URLs must contain schemes to be considered valid * implements feature requested in #5038
2020-05-10mypy: Use explicit "type: ignore[...]" ignoresFlorian Bruhin
See #5368
2020-05-09mypy: Fix wrong type annotationsFlorian Bruhin
See #5368
2020-05-09mypy: Don't use bytes() on QByteArraysFlorian Bruhin
See #5368 and https://bugreports.qt.io/browse/PYSIDE-1248
2020-05-09mypy: Remove unneeded casts/ignoresFlorian Bruhin
See #5368
2020-04-20Remove unneeded dictionaryFlorian Bruhin
2020-04-16Wrap long lineThorsten Wißmann
2020-04-04Only quote search engine terms if requestedThorsten Wißmann
In the search engine url replacement, only quote the search term if the search engine format explicitly requests this: - The placeholder {} quotes all characters except '/' like before of #4434. This seems to be the default for other browsers' search engines and to be supported by most websites. For example, https://en.wikipedia.org/wiki/AC/DC leads to the wikipedia article of AC/DC. - New placeholders allow to specify how the search term shall be quoted: {unquoted} inserts the plain search term, {semiquoted} behaves like {} and {quoted} inserts the quoted search term. For example, with c.url.searchengines['jpc'] = 'https://www.jpc.de/s/{quoted}' the command "jpc AC/DC" redirects to https://www.jpc.de/s/AC%2FDC given results for "AC/DC". Here, the placeholder {quoted} is indeed necessary (as of March 2020), since https://www.jpc.de/s/AC/DC only searches for "AC". This addresses the issue #1772 and partially reverts #4434 (making the there introduced behaviour configurable).
2020-01-04Adjust copyrights for 2020Florian Bruhin
2019-12-23Merge remote-tracking branch 'origin/pr/5139'Florian Bruhin
2019-12-20Move widened_hostnames to configutilsFlorian Bruhin
This avoids various circular imports such as: urlutils -> config -> configdata -> configtypes -> configexc -> jinja -> urlutils or: configutils -> urlutils -> config -> configutils
2019-12-09Fix IP address with port in naive url detectorarza
Fixes #5125.
2019-11-27Merge remote-tracking branch 'origin/pr/4707' into domain-mappingFlorian Bruhin
2019-11-24Fix regex for real this time!Florian Bruhin
See #5056
2019-11-24Fix regexFlorian Bruhin
See #5056
2019-11-24Merge remote-tracking branch 'origin/pr/5056'Florian Bruhin
2019-10-15mypy: check_untyped_defs for browser.webkitFlorian Bruhin
2019-10-13Fix crash when search engine has invalid URLarza
Fixes #970.
2019-10-13Fix searching for search engine name when url.open_base_url=truearza
Fixes #5072. Also fixes url.open_base_url with url.auto_search=never.
2019-10-13Fix indentationarza
2019-10-12Merge branch 'master' into auto_searcharza
2019-10-11Add type annotations for utils.urlutilsFlorian Bruhin
2019-10-02Fix searching e-mail addresses with search enginearza
2019-10-02Fix detecting scheme for URLs containing %20arza
Fixes #2429.
2019-10-02Detect non-URLs from forbidden ASCII characters in naive url detectorarza
See #5038.
2019-10-01pylint: Enable emptystring extensionFlorian Bruhin
2019-09-11Clean up urlutils error handlingFlorian Bruhin
2019-09-11Move urlutils.incdec_number to navigate.pyFlorian Bruhin
2019-07-18Use FullyEncoded to get URL segmentsFlorian Bruhin
See #4917, #4795
2019-05-24Ensure validity of URLsFlorian Bruhin