Hi,
We just discovered an issue in the action GetDirAndFileList from this extension. The CreateDates returned for some of the files are not correct. This is due to inconsistencies in the output for the files with the list command from the Unix FTP server. Depending on the age of the file the line contains a day month year or a day month time (without the year).
See also https://stackoverflow.com/questions/19155638/no-year-being-returned-using-listdirectorydetails-c-sharpExample:-rw-rw-rw- 1 user group 1125690 Apr 24 2018 abc.png-rw-rw-rw- 1 user group 129918 Oct 15 14:28 123.gifFor recent files, the Unix server returns the time and for older files the year. When no year is available, the generated date will use the current year, resulting in dates in Outsystems in the future. Here 15-10-2019 instead of 15-10-2018.We solved this by changing some code in FtpDirListParser.cs by subtracting a year from the derived date when this is in the future and there is a time in the received line of data from the Unix FTP server.Old code:
public override DateTime getCreationDate() { string match; match = (Regex.Match(this.line, UnixLine.regexp_date)).Value; return DateTime.Parse(match); } New code: public override DateTime getCreationDate() { string match; string time; DateTime UnixDateTime; match = (Regex.Match(this.line, UnixLine.regexp_date)).Value; time = (Regex.Match(this.line, UnixLine.regexp_hour)).Value; UnixDateTime = DateTime.Parse(match); if (time.Contains(":") && UnixDateTime > DateTime.Today) { UnixDateTime = UnixDateTime.AddYears(-1); } return UnixDateTime; }
Not sure if this logic is valid for all Unix FTP servers, but if you do encounter similar issues, our solution might be helpful.
Regards,
Peter Braat