diff --git a/src/github.com/matrix-org/dendrite/common/config/config.go b/src/github.com/matrix-org/dendrite/common/config/config.go index 069a88209..89c4a1703 100644 --- a/src/github.com/matrix-org/dendrite/common/config/config.go +++ b/src/github.com/matrix-org/dendrite/common/config/config.go @@ -310,6 +310,7 @@ func (config *Dendrite) check() error { func absPath(dir string, path Path) string { if filepath.IsAbs(string(path)) { + // filepath.Join cleans the path so we should clean the absolute paths as well for consistency. return filepath.Clean(string(path)) } return filepath.Join(dir, string(path)) diff --git a/src/github.com/matrix-org/dendrite/common/config/config_test.go b/src/github.com/matrix-org/dendrite/common/config/config_test.go index 2a090408d..f690882ef 100644 --- a/src/github.com/matrix-org/dendrite/common/config/config_test.go +++ b/src/github.com/matrix-org/dendrite/common/config/config_test.go @@ -74,15 +74,17 @@ func TestReadKey(t *testing.T) { if err != nil { t.Error("failed to load private key:", err) } - wantKeyID := "ed25519:c8NsuQ" + wantKeyID := testKeyID if wantKeyID != string(keyID) { t.Errorf("wanted key ID to be %q, got %q", wantKeyID, keyID) } } +const testKeyID = "ed25519:c8NsuQ" + const testKey = ` -----BEGIN MATRIX PRIVATE KEY----- -Key-ID: ed25519:c8NsuQ +Key-ID: ` + testKeyID + ` 7KRZiZ2sTyRR8uqqUjRwczuwRXXkUMYIUHq4Mc3t4bE= -----END MATRIX PRIVATE KEY----- `