Silently ignore time.ParseErrors
This commit is contained in:
parent
a9fb74984b
commit
17fef6c654
|
@ -81,7 +81,10 @@ func getUserX(c *gin.Context, db *sql.DB, orderBy string, limit int) {
|
||||||
curscore.FullCombo = osuapi.OsuBool(fc)
|
curscore.FullCombo = osuapi.OsuBool(fc)
|
||||||
curscore.Mods = osuapi.Mods(mods)
|
curscore.Mods = osuapi.Mods(mods)
|
||||||
t, err := time.Parse(common.OsuTimeFormat, rawTime)
|
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.JSON(200, defaultResponse)
|
||||||
c.Error(err)
|
c.Error(err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -154,7 +154,7 @@ func scoresPuts(md common.MethodData, whereClause string, params ...interface{})
|
||||||
}
|
}
|
||||||
// puck feppy
|
// puck feppy
|
||||||
us.Time, err = time.Parse(common.OsuTimeFormat, t)
|
us.Time, err = time.Parse(common.OsuTimeFormat, t)
|
||||||
if err != nil {
|
if _, ok := err.(*time.ParseError); !ok && err != nil {
|
||||||
md.Err(err)
|
md.Err(err)
|
||||||
return Err500
|
return Err500
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user