summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/pure/ftpclient.nim7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/pure/ftpclient.nim b/lib/pure/ftpclient.nim
index eaa8c82b2..301ca227a 100644
--- a/lib/pure/ftpclient.nim
+++ b/lib/pure/ftpclient.nim
@@ -270,11 +270,10 @@ proc connect*[T](ftp: FtpBase[T]) =
     reply = ftp.expectReply()
 
   # Handle 220 messages from the server
-  if reply.startsWith("220"):
+  assertReply ftp.expectReply(), "220"
+  while reply.continuesWith("-", 3): # handle multiline 220 message
     assertReply ftp.expectReply(), "220"
-    while reply.continuesWith("-", 3): # handle multiline 220 message
-      assertReply ftp.expectReply(), "220"
-      reply = ftp.expectReply()
+    reply = ftp.expectReply()
 
   if ftp.user != "":
     assertReply(ftp.send("USER " & ftp.user), "230", "331")