From fc57c921b1716f0f84b5b2d4d5693091c48a4b2d Mon Sep 17 00:00:00 2001 From: Kousik Mitra Date: Sat, 18 Apr 2020 12:49:29 +0530 Subject: [PATCH] conf: fallback time layout to RFC 3339 when misconfigured (#6120) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix: fallback to default time format if misconfigured (#6098) * Update CHANGELOG.md Co-authored-by: ᴜɴᴋɴᴡᴏɴ --- CHANGELOG.md | 1 + internal/conf/conf.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 766169ee9..26431537a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ All notable changes to Gogs are documented in this file. - Enable Federated Avatar Lookup could cause server to crash. [#5848](https://github.com/gogs/gogs/issues/5848) - Private repositories are hidden in the organization's view. [#5869](https://github.com/gogs/gogs/issues/5869) - Server error when changing email address in user settings page. [#5899](https://github.com/gogs/gogs/issues/5899) +- Fall back to use RFC 3339 as time layout when misconfigured. [#6098](https://github.com/gogs/gogs/issues/6098) - Webhooks are not fired after push when `[service] REQUIRE_SIGNIN_VIEW = true`. ### Removed diff --git a/internal/conf/conf.go b/internal/conf/conf.go index 0f6854838..5a16951e0 100644 --- a/internal/conf/conf.go +++ b/internal/conf/conf.go @@ -294,7 +294,7 @@ func Init(customConf string) error { "StampNano": time.StampNano, }[Time.Format] if Time.FormatLayout == "" { - return fmt.Errorf("unrecognized '[time] FORMAT': %s", Time.Format) + Time.FormatLayout = time.RFC3339 } // ****************************