Search code examples
delphiindy

Indy 10 FTP empty list


I have been receiving reports from some of my users that, when using idFTP.List() from some servers (MS FTP) then the listing is received as empty (no files) when in reality there are (non-hidden) files on the current directory. May this be a case of a missing parser? The funny think, when I use the program to get the list from MY server (MSFTP on W2003) everything seems OK but on some servers I've been hitting this problem.

Using latest Indy10 on D2010. Any idea?


Solution

  • IdFTPListParseWindowsNT is broken.

    The function CheckListing returns false because of a bad parsing:

    if sDir = '  <DI' then begin   {do not localize}
        sDir := Copy(SData, 27, 5);
      end else begin
        sDir := Copy(SData, 26,28);  <---------------BAD PASRSING
        Result := TextStartsWith(sDir,'  <DI') or IsNumeric(TrimLeft(sDir));
        if not Result then begin
           Exit;
        end;     
    
      end;
    

    Commenting this part to make it work like in older versions

        if sDir = '  <DI' then begin   {do not localize}
            sDir := Copy(SData, 27, 5);
          end;
    
    { else begin
            sDir := Copy(SData, 26,28);  <---------------BAD PASRSING
            Result := TextStartsWith(sDir,'  <DI') or IsNumeric(TrimLeft(sDir));
            if not Result then begin
               Exit;
            end;     
    
      end;}
    

    Showuld solve your problem. Don't know why this change was introduced, though.