Repository: aio-libs/aioftp

Issue:
`parse_ls_date` doesn't handle singe-spaced servers.
I'm using aioftp across a multitude of FTP servers, and just discovered that one of them uses a timestamp of `%b %d %Y` instead of `%b %d  %Y`.
Because the parser assumes the date is exactly 12 characters long, it will catch `Jan 03 2018` as `Jan 03 2018 `. This in turn leads to a datetime parsing error.

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/aio-libs/aioftp/pull/113?src=pr&el=h1) Report
> Merging [#113](https://codecov.io/gh/aio-libs/aioftp/pull/113?src=pr&el=desc) into [master](https://codecov.io/gh/aio-libs/aioftp/commit/531b63eface3500b82cb2bf596da63876c1d5417&el=desc) will **not change** coverage.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/aio-libs/aioftp/pull/113/graphs/tree.svg?width=650&height=150&src=pr&token=CQXBXDpq1g)](https://codecov.io/gh/aio-libs/aioftp/pull/113?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master     #113   +/-   ##
=======================================
  Coverage   99.35%   99.35%           
=======================================
  Files           6        6           
  Lines        1864     1864           
=======================================
  Hits         1852     1852           
  Misses         12       12           
```


| [Impacted Files](https://codecov.io/gh/aio-libs/aioftp/pull/113?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [aioftp/client.py](https://codecov.io/gh/aio-libs/aioftp/pull/113/diff?src=pr&el=tree#diff-YWlvZnRwL2NsaWVudC5weQ==) | `98.75% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/aio-libs/aioftp/pull/113?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/aio-libs/aioftp/pull/113?src=pr&el=footer). Last update [531b63e...1d1f5e5](https://codecov.io/gh/aio-libs/aioftp/pull/113?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

pohmelie: > Maybe I'm blind, but I don't see a CHANGES folder.

There is a `history.rst` file.

Patch:
diff --git a/aioftp/client.py b/aioftp/client.py
index a1072b6..566a397 100644
--- a/aioftp/client.py
+++ b/aioftp/client.py
@@ -360,7 +360,7 @@ class BaseClient:
     def parse_ls_date(cls, s, *, now=None):
         """
         Parsing dates from the ls unix utility. For example,
-        "Nov 18  1958" and "Nov 18 12:29".
+        "Nov 18  1958", "Jan 03 2018", and "Nov 18 12:29".
 
         :param s: ls date
         :type s: :py:class:`str`
@@ -439,7 +439,7 @@ class BaseClient:
             raise ValueError
 
         s = s[i:].lstrip()
-        info["modify"] = self.parse_ls_date(s[:12])
+        info["modify"] = self.parse_ls_date(s[:12].strip())
         s = s[12:].strip()
         if info["type"] == "link":
             i = s.rindex(" -> ")
diff --git a/history.rst b/history.rst
index 20ea7de..a78574f 100644
--- a/history.rst
+++ b/history.rst
@@ -1,6 +1,9 @@
 x.x.x (xx-xx-xxxx)
 ------------------
 
+- client: strip date before parsing (#113)
+Thanks to `ndhansen <https://github.com/ndhansen>`_
+
 0.16.0 (11-03-2020)
 ------------------
 


Test patch:
diff --git a/tests/test_simple_functions.py b/tests/test_simple_functions.py
index cada55a..e46448b 100644
--- a/tests/test_simple_functions.py
+++ b/tests/test_simple_functions.py
@@ -165,6 +165,8 @@ def test_parse_list_line_unix():
         ],
         "dir": [
             "drw-rw-r--  1 poh  poh   6595 Feb 27 04:14 history.rst",
+            "drw-rw-r--  1 poh  poh   6595 Jan 03 2016  changes.rst",
+            "drw-rw-r--  1 poh  poh   6595 Mar 10  1996 README.rst",
         ],
         "unknown": [
             "Erw-rw-r--  1 poh  poh   6595 Feb 27 04:14 history.rst",