From 6fff0ba5388fd93287e6ddc67a7e2c44bf86df67 Mon Sep 17 00:00:00 2001 From: Mohammed Sohail Date: Wed, 15 Jan 2025 14:24:03 +0300 Subject: [PATCH] feat: discard 0x2e in session_id bytes 0x2e was added herehttps://holbrook.no/src/go-vise/file/db/db.go.html#l147, so we discard the last 3 bytes --- pkg/data/decode.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/data/decode.go b/pkg/data/decode.go index d98bf5b..9b58055 100644 --- a/pkg/data/decode.go +++ b/pkg/data/decode.go @@ -8,12 +8,13 @@ const () // DecodeKey specifically only decodes user data keys stored as bytes into its respective session ID and data type // TODO: Replace return data type with imported data types from the common package once lib-gdbm dependency is removed. +// Note: 0x2e was added herehttps://holbrook.no/src/go-vise/file/db/db.go.html#l147, so we discard the last 3 bytes func DecodeKey(key []byte) (uint16, string) { if key[0] != keyPrefix { return 0, "" } - return binary.BigEndian.Uint16(key[len(key)-2:]), string(key[1 : len(key)-2]) + return binary.BigEndian.Uint16(key[len(key)-2:]), string(key[1 : len(key)-3]) } // DecodeValue returns the utf-8 string representation of the value stored in the storage backend