The Great Linting Fixes, Drone configuration fix (again) and flatfile changes.

Great linting fixes has been applied, thanks to golangci-lint for
extensive reporting.

Fixed Drone configuration to use array for when-branch statement in
Docker plugin.

Flatfile storage from now will write files with 0600 permission for
greater security.
This commit is contained in:
2021-11-20 22:19:58 +05:00
parent 218e0bf667
commit 2b44a60ee7
14 changed files with 154 additions and 156 deletions

View File

@@ -35,12 +35,12 @@ import (
)
// Index of this site.
func indexGet(ec echo.Context) error {
func indexGet(ectx echo.Context) error {
// We should check if database connection available.
dbConn := c.Database.GetDatabaseConnection()
if c.Config.Database.Type != flatfiles.FlatFileDialect && dbConn == nil {
// nolint:wrapcheck
return ec.Redirect(http.StatusFound, "/database_not_available")
return ectx.Redirect(http.StatusFound, "/database_not_available")
}
// Generate list of available languages to highlight.
@@ -54,8 +54,8 @@ func indexGet(ec echo.Context) error {
// Captcha.
captchaString := captcha.NewCaptcha()
htmlData := templater.GetTemplate(ec, "index.html", map[string]string{"lexers": availableLexersSelectOpts, "captchaString": captchaString})
htmlData := templater.GetTemplate(ectx, "index.html", map[string]string{"lexers": availableLexersSelectOpts, "captchaString": captchaString})
// nolint:wrapcheck
return ec.HTML(http.StatusOK, htmlData)
return ectx.HTML(http.StatusOK, htmlData)
}