update: Support backward compatible date formate

This commit is contained in:
Harshavardhana
2015-11-13 22:12:30 -08:00
parent 2e072ec010
commit 07abb224e6
+9 -2
View File
@@ -18,6 +18,7 @@ package main
import (
"encoding/json"
"net/http"
"runtime"
"strings"
"time"
@@ -145,7 +146,10 @@ func getExperimentalUpdate() {
fatalIf(probe.NewError(e), "Unable to decode experimental update notification.")
latest, e := time.Parse(time.RFC3339, experimentals.BuildDate)
fatalIf(probe.NewError(e), "Unable to parse BuildDate.")
if e != nil {
latest, e = time.Parse(http.TimeFormat, experimentals.BuildDate)
fatalIf(probe.NewError(e), "Unable to parse BuildDate.")
}
if latest.IsZero() {
fatalIf(errDummy().Trace(), "Unable to validate any experimental update available at this time. Please open an issue at https://github.com/minio/mc/issues")
@@ -192,7 +196,10 @@ func getReleaseUpdate() {
fatalIf(probe.NewError(e), "Unable to decode update notification.")
latest, e := time.Parse(time.RFC3339, updates.BuildDate)
fatalIf(probe.NewError(e), "Unable to parse BuildDate.")
if e != nil {
latest, e = time.Parse(http.TimeFormat, updates.BuildDate)
fatalIf(probe.NewError(e), "Unable to parse BuildDate.")
}
if latest.IsZero() {
fatalIf(errDummy().Trace(), "Unable to validate any update available at this time. Please open an issue at https://github.com/minio/mc/issues")