File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## 2.40.1
4+
5+ - Security fixes (thanks @tonghuaroot for
6+ [ the report] ( https://github.com/lucasdillmann/nginx-ignition/security/advisories/GHSA-jr34-h97m-9hpx ) !)
7+
38## 2.40.0
49
510- Users can now update their own name and username from the account settings modal in the shell header.
Original file line number Diff line number Diff line change @@ -2,18 +2,25 @@ package server
22
33import (
44 "context"
5+ "strings"
56
67 "github.com/gin-gonic/gin"
78 "golang.org/x/text/language"
89
910 "dillmann.com.br/nginx-ignition/core/common/i18n"
1011)
1112
13+ const maximumLanguageTags = 10
14+
1215func i18nMiddleware (commands i18n.Commands ) gin.HandlerFunc {
1316 return func (ginCtx * gin.Context ) {
1417 lang := commands .DefaultLanguage ()
1518
1619 langHeader := ginCtx .GetHeader ("Accept-Language" )
20+ if strings .Count (langHeader , "-" )+ strings .Count (langHeader , "_" ) > maximumLanguageTags {
21+ langHeader = ""
22+ }
23+
1724 tags , _ , err := language .ParseAcceptLanguage (langHeader )
1825 if err == nil && len (tags ) > 0 {
1926 for _ , tag := range tags {
You can’t perform that action at this time.
0 commit comments