From bc154193fa9196e4ea407fc5cbd92bd6fe283026 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Mon, 17 Jun 2002 17:02:49 +0000 Subject: [PATCH] Tidied a little git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13908 72102866-910b-0410-8b05-ffd578937521 --- Source/GSFTPURLHandle.m | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/Source/GSFTPURLHandle.m b/Source/GSFTPURLHandle.m index a386d2096..4f1d3c318 100644 --- a/Source/GSFTPURLHandle.m +++ b/Source/GSFTPURLHandle.m @@ -752,7 +752,39 @@ static NSLock *urlLock = nil; } else if (state == list) { - if ([line hasPrefix: @"1"] == NO && [line hasPrefix: @"2"] == NO) + if ([line hasPrefix: @"550"] == YES) + { + NSRange r = [line rangeOfString: @"not a plain file"]; + + /* + * Some servers may return an error on listing even though + * the path was a valid directory. We try to catch some of + * those cases and produce an empty listing instead. + */ + if (r.location > 0) + { + NSNotificationCenter *nc; + + nc = [NSNotificationCenter defaultCenter]; + if (dHandle != nil) + { + [nc removeObserver: self name: nil object: dHandle]; + [dHandle closeFile]; + DESTROY(dHandle); + } + [nc removeObserver: self + name: GSTelnetNotification + object: cHandle]; + DESTROY(cHandle); + state = idle; + [self didLoadBytes: [NSData data] loadComplete: YES]; + } + else + { + e = line; + } + } + else if ([line hasPrefix: @"1"] == NO && [line hasPrefix: @"2"] == NO) { e = line; }