Strip embedded whitespace from URLs given at the commandline or the GUI.

This commit is contained in:
Bastian Kleineidam 2011-03-07 12:54:35 +01:00
parent 420c21c2de
commit f2f05af3dc
4 changed files with 5 additions and 3 deletions

View file

@ -9,6 +9,8 @@ Changes:
sending false positive status codes for HEAD requests.
- checking: Strip leading and trailing whitespace from URLs and print
a warning instead of having errors.
Also all embedded whitespace is stripped from URLs given at the
commandline or the GUI.
Closes: SF bug #3196918

View file

@ -262,7 +262,7 @@ Version 2 or later.
def get_url (self):
"""Return URL to check from the urlinput widget."""
url = unicode(self.urlinput.text()).strip()
url = strformat.stripall(unicode(self.urlinput.text()))
if url.startswith(u"www."):
url = u"http://%s" % url
elif url.startswith(u"ftp."):

View file

@ -77,7 +77,7 @@ def checklink (out=sys.stdout, form=None, env=os.environ):
# start checking
aggregate = director.get_aggregate(config)
get_url_from = checker.get_url_from
url = form["url"].value
url = strformat.stripall(form["url"].value)
url_data = get_url_from(url, 0, aggregate)
try:
add_intern_pattern(url_data, config)

View file

@ -761,7 +761,7 @@ if options.stdin:
args.extend(read_stdin_urls())
if args:
for url in args:
aggregate_url(aggregate, config, url)
aggregate_url(aggregate, config, strformat.stripall(url))
else:
log.warn(LOG_CMDLINE, _("no files or URLs given"))
# set up profiling