From c4d34db748b8a452e70b326a094609a9e3eb9745 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 16 Jun 2017 15:15:11 +0100 Subject: [PATCH] more review comments! --- src/github.com/matrix-org/dendrite/common/config/config.go | 1 + .../matrix-org/dendrite/common/config/config_test.go | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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----- `