소스 검색

BitSequence should unmarshal data during get

When bit sequence is trying to get key/value from the
data store it should always unmarshall the json data
before using it, as the data is JSON marshalled before
storing it in the data store.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Jana Radhakrishnan 10 년 전
부모
커밋
6692b6d072
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      libnetwork/bitseq/store.go

+ 6 - 1
libnetwork/bitseq/store.go

@@ -40,7 +40,12 @@ func (h *Handle) Value() []byte {
 
 
 // SetValue unmarshals the data from the KV store
 // SetValue unmarshals the data from the KV store
 func (h *Handle) SetValue(value []byte) error {
 func (h *Handle) SetValue(value []byte) error {
-	return h.FromByteArray(value)
+	var b []byte
+	if err := json.Unmarshal(value, &b); err != nil {
+		return err
+	}
+
+	return h.FromByteArray(b)
 }
 }
 
 
 // Index returns the latest DB Index as seen by this object
 // Index returns the latest DB Index as seen by this object