mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-10 23:53:11 +00:00
ignore empty filenames in filelist
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2097 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
0d9627c259
commit
9829268533
1 changed files with 12 additions and 11 deletions
|
|
@ -123,19 +123,20 @@ class FtpUrl (urlbase.UrlBase, proxysupport.ProxySupport):
|
|||
|
||||
def listfile (self):
|
||||
"""see if filename is in the current FTP directory"""
|
||||
if not self.filename:
|
||||
return
|
||||
files = self.get_files()
|
||||
linkcheck.log.debug(linkcheck.LOG_CHECK, "FTP files %s", str(files))
|
||||
if self.filename:
|
||||
if self.filename in files:
|
||||
# file found
|
||||
return
|
||||
# it could be a directory if the trailing slash was forgotten
|
||||
if "%s/" % self.filename in files:
|
||||
if not self.url.endswith('/'):
|
||||
self.add_warning(
|
||||
_("Missing trailing directory slash in ftp url."))
|
||||
self.url += '/'
|
||||
return
|
||||
if self.filename in files:
|
||||
# file found
|
||||
return
|
||||
# it could be a directory if the trailing slash was forgotten
|
||||
if "%s/" % self.filename in files:
|
||||
if not self.url.endswith('/'):
|
||||
self.add_warning(
|
||||
_("Missing trailing directory slash in ftp url."))
|
||||
self.url += '/'
|
||||
return
|
||||
raise ftplib.error_perm, "550 File not found"
|
||||
|
||||
def get_files (self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue