summaryrefslogtreecommitdiff
path: root/internal/router/session_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-04-16 13:09:42 +0200
committerLibravatar GitHub <noreply@github.com>2022-04-16 13:09:42 +0200
commit7883dd54998f351e2f59d1e8e4238eb906f79ade (patch)
tree25f9863237b3a98a1b930068579f0810d7098bfc /internal/router/session_test.go
parent[bugfix] Use background ctx for domain block side effects (#457) (diff)
downloadgotosocial-7883dd54998f351e2f59d1e8e4238eb906f79ade.tar.xz
[bugfix] Convert IDNs to punycode before using as session name (#458)
* convert hostname to punycode for session name * test punycode
Diffstat (limited to 'internal/router/session_test.go')
-rw-r--r--internal/router/session_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/router/session_test.go b/internal/router/session_test.go
index 40ceae346..d36da9596 100644
--- a/internal/router/session_test.go
+++ b/internal/router/session_test.go
@@ -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{})
}