[bugfix] Convert IDNs to punycode before using as session name (#458)

* convert hostname to punycode for session name

* test punycode
This commit is contained in:
tobi 2022-04-16 13:09:42 +02:00 committed by GitHub
commit 7883dd5499
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View file

@ -82,6 +82,15 @@ func (suite *SessionTestSuite) TestDeriveSessionOK() {
suite.Equal("gotosocial-example.org", sessionName)
}
func (suite *SessionTestSuite) TestDeriveSessionIDNOK() {
viper.Set(config.Keys.Protocol, "https")
viper.Set(config.Keys.Host, "fóid.org")
sessionName, err := router.SessionName()
suite.NoError(err)
suite.Equal("gotosocial-xn--fid-gna.org", sessionName)
}
func TestSessionTestSuite(t *testing.T) {
suite.Run(t, &SessionTestSuite{})
}