Indy 8.1 Beta - IdFTPList

I'm using the FTP list parsers from Indy 8.1 for an application that I'm
writing (www.ashleybrown.co.uk/dotedit). In tests it seemed to work fine,
but on a couple of servers it failed with "Invalid Argument to Date Encode".
Obviously the parsing was wrong - the servers in question were Unix, just
like some of the others I'd used. On inspection, the Indy Beta code assumes
the length of the directory list elements:

------------------
IdFTPList.pas (Line 341+)

  // Copy the predictable pieces
  LDir := UpperCase(Copy(AItem.Data, 1, 1));
  LOPerm := Copy(AItem.Data, 2, 3);
  LGPerm := Copy(AItem.Data, 5, 3);
  LUPerm := Copy(AItem.Data, 8, 3);
  LCount := Trim(Copy(AItem.Data, 11, 5));
  LOwner := Copy(AItem.Data, 16, 8);
  LGroup := Copy(AItem.Data, 25, 8);

  // Scan for the rest
  LBuffer := Trim(Copy(AItem.Data, 33, Length(AItem.Data)));

  // Scan size
  LSize := Fetch(LBuffer);

...

------------------
The FTP servers which I've been testing with don't limit the Owner/Group
fields to 8 characters. I modified the code to:

------------------
  // Copy the predictable pieces
  LDir := UpperCase(Copy(AItem.Data, 1, 1));
  LOPerm := Copy(AItem.Data, 2, 3);
  LGPerm := Copy(AItem.Data, 5, 3);
  LUPerm := Copy(AItem.Data, 8, 3);
  LCount := Trim(Copy(AItem.Data, 11, 5));

  // Scan for the rest
  LBuffer := Trim(Copy(AItem.Data, 16, Length(AItem.Data))); // AB

  LOwner := Fetch(LBuffer);
  LBuffer := Trim(LBuffer);

  LGroup := Fetch(LBuffer);
  LBuffer := Trim(LBuffer);

  // Scan size
  LSize := Fetch(LBuffer);
------------------

It now works fine on every server that I've tested with.

Regards,
Ashley Brown
Internet Developer
http://www.ashleybrown.co.uk