1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

fs: fix parsing of times and durations of the form "YYYY-MM-DD HH:MM:SS"

Before this fix, the parsing code gave an error like this

    parsing "2022-08-02 07:00:00" as fs.Time failed: expected newline

This was due to the Scan call failing to read all the data.

This patch fixes that, and redoes the tests
This commit is contained in:
Nick Craig-Wood
2022-08-05 15:23:44 +01:00
parent ebe86c6cec
commit 16039b350d
4 changed files with 42 additions and 17 deletions

View File

@@ -83,7 +83,7 @@ func (t *Time) UnmarshalJSON(in []byte) error {
// Scan implements the fmt.Scanner interface
func (t *Time) Scan(s fmt.ScanState, ch rune) error {
token, err := s.Token(true, nil)
token, err := s.Token(true, func(rune) bool { return true })
if err != nil {
return err
}