mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-03 04:14:43 +00:00
Assume URL starts with http:// if its not a local file.
This commit is contained in:
parent
d306f2c317
commit
7807be517b
3 changed files with 19 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
|||
6.0 "" (released xx.xx.2010)
|
||||
6.0 "Kung Fu Panda Holiday Special" (released xx.12.2010)
|
||||
|
||||
Fixes:
|
||||
- checking: Fall back to HTTP GET requests when the connection has
|
||||
|
|
@ -25,6 +25,8 @@ Changes:
|
|||
Features:
|
||||
- gui: Store column widths in registry settings.
|
||||
- gui: Add ability to save results to local files with File->Save.
|
||||
- gui: Assume the entered URL starts with http:// if it has no
|
||||
scheme specified and is not a valid local file.
|
||||
|
||||
|
||||
5.5 "Red" (released 20.11.2010)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ Migrating from 5.5 to 6.0
|
|||
|
||||
Python 2.6 or newer is required (Python 3.x is not supported though).
|
||||
|
||||
The --no-proxy-for and --no-anchor-caching options have been removed.
|
||||
The deprecated --no-proxy-for and --no-anchor-caching options have been
|
||||
removed.
|
||||
|
||||
The configuration file now requires multiline syntax for the options
|
||||
"nofollow", "ignore" and "entry".
|
||||
|
|
|
|||
|
|
@ -230,19 +230,28 @@ Version 2 or later.</p>
|
|||
|
||||
on_controlButton_clicked = on_urlinput_returnPressed = start
|
||||
|
||||
def get_url (self):
|
||||
"""Return URL to check from the urlinput widget."""
|
||||
url = unicode(self.urlinput.text()).strip()
|
||||
if url.startswith(u"www."):
|
||||
url = u"http://%s" % url
|
||||
elif url.startswith(u"ftp."):
|
||||
url = u"ftp://%s" % url
|
||||
elif u":" not in url:
|
||||
# Look for local filename, else assume it's an HTTP URL.
|
||||
if not os.path.isfile(url):
|
||||
url = u"http://%s" % url
|
||||
return url
|
||||
|
||||
def check (self):
|
||||
"""Check given URL."""
|
||||
self.model.clear()
|
||||
self.set_config()
|
||||
aggregate = director.get_aggregate(self.config)
|
||||
url = unicode(self.urlinput.text()).strip()
|
||||
url = self.get_url()
|
||||
if not url:
|
||||
self.set_statusbar(_("Error, empty URL"))
|
||||
return
|
||||
if url.startswith(u"www."):
|
||||
url = u"http://%s" % url
|
||||
elif url.startswith(u"ftp."):
|
||||
url = u"ftp://%s" % url
|
||||
self.set_statusbar(_("Checking '%s'.") % strformat.limit(url, 40))
|
||||
url_data = checker.get_url_from(url, 0, aggregate)
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue