Silently ignore time.ParseErrors

This commit is contained in:
Howl 2016-08-09 19:15:53 +02:00
parent a9fb74984b
commit 17fef6c654
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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
}