mirror of
https://github.com/unmojang/drasl.git
synced 2025-08-03 10:56:06 -04:00
Lint
This commit is contained in:
parent
9901aa8776
commit
817bb432c2
@ -189,6 +189,9 @@ func (app *App) AuthlibInjectorDeleteTexture(textureType string) func(c echo.Con
|
||||
nil, // capeURL
|
||||
textureType == TextureTypeCape, // deleteCape
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.NoContent(http.StatusNoContent)
|
||||
})
|
||||
|
@ -397,6 +397,9 @@ func CleanConfig(config *Config) error {
|
||||
oidcConfig.Issuer,
|
||||
false,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -418,7 +421,7 @@ RequireInvite = true
|
||||
`
|
||||
|
||||
func HandleDeprecations(config Config, metadata *toml.MetaData) [][]string {
|
||||
deprecatedPaths := make([][]string, 0, 0)
|
||||
deprecatedPaths := make([][]string, 0)
|
||||
|
||||
warningTemplate := "Warning: config option %s is deprecated and will be removed in a future version. Use %s instead."
|
||||
|
||||
|
@ -169,7 +169,7 @@ func (ts *TestSuite) testMigrateBackwards(t *testing.T) {
|
||||
query, err := os.ReadFile("sql/1.sql")
|
||||
assert.Nil(t, err)
|
||||
assert.Nil(t, db.Exec(string(query)).Error)
|
||||
setUserVersion(db, CURRENT_USER_VERSION+1)
|
||||
assert.Nil(t, setUserVersion(db, CURRENT_USER_VERSION+1))
|
||||
|
||||
err = Migrate(ts.Config, mo.None[string](), db, true, CURRENT_USER_VERSION)
|
||||
var backwardsMigrationError BackwardsMigrationError
|
||||
|
12
front.go
12
front.go
@ -101,9 +101,9 @@ func (app *App) setSuccessMessage(c *echo.Context, template string, args ...inte
|
||||
app.setMessageCookie(c, SUCCESS_MESSAGE_COOKIE_NAME, template, args...)
|
||||
}
|
||||
|
||||
func (app *App) setWarningMessage(c *echo.Context, template string, args ...interface{}) {
|
||||
app.setMessageCookie(c, WARNING_MESSAGE_COOKIE_NAME, template, args...)
|
||||
}
|
||||
// func (app *App) setWarningMessage(c *echo.Context, template string, args ...interface{}) {
|
||||
// app.setMessageCookie(c, WARNING_MESSAGE_COOKIE_NAME, template, args...)
|
||||
// }
|
||||
|
||||
func (app *App) setErrorMessage(c *echo.Context, template string, args ...interface{}) {
|
||||
app.setMessageCookie(c, ERROR_MESSAGE_COOKIE_NAME, template, args...)
|
||||
@ -153,11 +153,11 @@ func (app *App) HandleWebError(err error, c *echo.Context) error {
|
||||
var webError *WebError
|
||||
var userError *UserError
|
||||
if errors.As(err, &webError) {
|
||||
app.setErrorMessage(c, webError.Error())
|
||||
app.setErrorMessage(c, "%s", webError.Error())
|
||||
return (*c).Redirect(http.StatusSeeOther, webError.ReturnURL)
|
||||
} else if errors.As(err, &userError) {
|
||||
returnURL := getReturnURL(app, c)
|
||||
app.setErrorMessage(c, userError.Error())
|
||||
app.setErrorMessage(c, "%s", userError.Error())
|
||||
return (*c).Redirect(http.StatusSeeOther, returnURL)
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ func (app *App) HandleWebError(err error, c *echo.Context) error {
|
||||
})
|
||||
} else {
|
||||
returnURL := getReturnURL(app, c)
|
||||
app.setErrorMessage(c, message)
|
||||
app.setErrorMessage(c, "%s", message)
|
||||
return (*c).Redirect(http.StatusSeeOther, returnURL)
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ func (ts *TestSuite) createPlayerShouldSucceed(t *testing.T, rec *httptest.Respo
|
||||
|
||||
returnURLExp := regexp.MustCompile("^" + regexp.QuoteMeta(ts.App.FrontEndURL+"/web/player/") + "(.+)$")
|
||||
uuidMatch := returnURLExp.FindStringSubmatch(rec.Header().Get("Location"))
|
||||
assert.True(t, uuidMatch != nil && len(uuidMatch) == 2)
|
||||
assert.True(t, len(uuidMatch) == 2)
|
||||
uuid_ := uuidMatch[1]
|
||||
_, err := uuid.Parse(uuid_)
|
||||
assert.Nil(t, err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user