summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoofar <toofar@spalge.com>2023-06-04 12:04:08 +1200
committertoofar <toofar@spalge.com>2023-06-04 12:04:08 +1200
commit5dd637f4447e4c5185ea47162fe9d3dcdf5d6a17 (patch)
tree7fa1b7cea5037b179a5aa6b2ff2323d991318dca
parenta73fee80453ef485f8df35000de06d6732ba9af6 (diff)
parenta31b6542529f5042b947b45fdeb8cd51595784fc (diff)
downloadqutebrowser-5dd637f4447e4c5185ea47162fe9d3dcdf5d6a17.tar.gz
qutebrowser-5dd637f4447e4c5185ea47162fe9d3dcdf5d6a17.zip
Merge pull request #7723 from ralsina/use-netloc-in-qute-pass
Use url netloc as a candidate key for qute-pass
-rwxr-xr-xmisc/userscripts/qute-pass7
1 files changed, 5 insertions, 2 deletions
diff --git a/misc/userscripts/qute-pass b/misc/userscripts/qute-pass
index bdee94bb5..e3215e124 100755
--- a/misc/userscripts/qute-pass
+++ b/misc/userscripts/qute-pass
@@ -58,6 +58,7 @@ import re
import shlex
import subprocess
import sys
+from urllib.parse import urlparse
import tldextract
@@ -221,7 +222,7 @@ def main(arguments):
# Try to find candidates using targets in the following order: fully-qualified domain name (includes subdomains),
# the registered domain name, the IPv4 address if that's what the URL represents and finally the private domain
- # (if a non-public suffix was used).
+ # (if a non-public suffix was used), and the URL netloc.
candidates = set()
attempted_targets = []
@@ -230,7 +231,9 @@ def main(arguments):
private_domain = ('.'.join((extract_result.subdomain, extract_result.domain))
if extract_result.subdomain else extract_result.domain)
- for target in filter(None, [extract_result.fqdn, extract_result.registered_domain, extract_result.ipv4, private_domain]):
+ netloc = urlparse(arguments.url).netloc
+
+ for target in filter(None, [extract_result.fqdn, extract_result.registered_domain, extract_result.ipv4, private_domain, netloc]):
attempted_targets.append(target)
target_candidates = find_pass_candidates(target, unfiltered=arguments.unfiltered)
if not target_candidates: