From 9829268533c47113556869432e538aea146be87d Mon Sep 17 00:00:00 2001 From: calvin Date: Tue, 7 Dec 2004 08:16:20 +0000 Subject: [PATCH] ignore empty filenames in filelist git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2097 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/checker/ftpurl.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/linkcheck/checker/ftpurl.py b/linkcheck/checker/ftpurl.py index 3283fedb..4e63611a 100644 --- a/linkcheck/checker/ftpurl.py +++ b/linkcheck/checker/ftpurl.py @@ -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):