summaryrefslogtreecommitdiff
path: root/client/service_logs.go
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2017-11-03 17:39:53 +0100
committerSebastiaan van Stijn <github@gone.nl>2018-05-20 13:07:17 +0200
commit48cfe3f0872647bf0f52e6ba65022e1859e808e8 (patch)
tree22832a5031181cfe28407c35fc6b38f08aca5e57 /client/service_logs.go
parentf9dd74deee364dd513615ea112e78008a946b3e5 (diff)
downloaddocker-48cfe3f0872647bf0f52e6ba65022e1859e808e8.tar.gz
Improve GetTimestamp parsing
`GetTimestamp()` "assumed" values it could not parse to be a valid unix timestamp, and would use invalid values ("hello world") as-is (even testing that it did so). This patch validates unix timestamp to be a valid numeric value, and makes other values invalid. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'client/service_logs.go')
-rw-r--r--client/service_logs.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/client/service_logs.go b/client/service_logs.go
index af96b1e62c..906fd4059e 100644
--- a/client/service_logs.go
+++ b/client/service_logs.go
@@ -8,6 +8,7 @@ import (
"github.com/docker/docker/api/types"
timetypes "github.com/docker/docker/api/types/time"
+ "github.com/pkg/errors"
)
// ServiceLogs returns the logs generated by a service in an io.ReadCloser.
@@ -25,7 +26,7 @@ func (cli *Client) ServiceLogs(ctx context.Context, serviceID string, options ty
if options.Since != "" {
ts, err := timetypes.GetTimestamp(options.Since, time.Now())
if err != nil {
- return nil, err
+ return nil, errors.Wrap(err, `invalid value for "since"`)
}
query.Set("since", ts)
}