Skip to content

Commit

Permalink
Merge pull request #50 from celenium-io/fix/decode-ns-id
Browse files Browse the repository at this point in the history
Fix: decode namespace id
  • Loading branch information
aopoltorzhicky committed Nov 22, 2023
2 parents 978c42f + bb331bf commit 03c14c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/api/handler/responses/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (Namespace) SearchType() string {

func decodeName(nsId []byte) string {
var (
trimmed = bytes.Trim(nsId, "\x00")
trimmed = bytes.TrimLeft(nsId, "\x00")
data = make([]byte, 0)
isDecodable = true
)
Expand Down
4 changes: 4 additions & 0 deletions cmd/api/handler/responses/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func Test_decodeName(t *testing.T) {
name: "test 4",
nsId: "00000000000000000000000000000000000000e6edd3ffbef8c700d8",
want: "e6edd3ffbef8c700d8",
}, {
name: "test 5",
nsId: "00000000000000000000000000000000006d656d657300",
want: "6d656d657300",
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 03c14c7

Please sign in to comment.