From 17fef6c6549b3f5db5a4adb00098283de629db21 Mon Sep 17 00:00:00 2001 From: Howl Date: Tue, 9 Aug 2016 19:15:53 +0200 Subject: [PATCH] Silently ignore time.ParseErrors --- app/peppy/user_x.go | 5 ++++- app/v1/user_scores.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/peppy/user_x.go b/app/peppy/user_x.go index cfd470d..0a0547a 100644 --- a/app/peppy/user_x.go +++ b/app/peppy/user_x.go @@ -81,7 +81,10 @@ func getUserX(c *gin.Context, db *sql.DB, orderBy string, limit int) { curscore.FullCombo = osuapi.OsuBool(fc) curscore.Mods = osuapi.Mods(mods) t, err := time.Parse(common.OsuTimeFormat, rawTime) - if err != nil { + // silently ignore ParseErrors. should probably put something in the + // cron to restrict all users who have an "unusual" time format in + // their scores. + if _, ok := err.(*time.ParseError); !ok && err != nil { c.JSON(200, defaultResponse) c.Error(err) return diff --git a/app/v1/user_scores.go b/app/v1/user_scores.go index 0df05e7..528e22e 100644 --- a/app/v1/user_scores.go +++ b/app/v1/user_scores.go @@ -154,7 +154,7 @@ func scoresPuts(md common.MethodData, whereClause string, params ...interface{}) } // puck feppy us.Time, err = time.Parse(common.OsuTimeFormat, t) - if err != nil { + if _, ok := err.(*time.ParseError); !ok && err != nil { md.Err(err) return Err500 }