Skip to content

Commit

Permalink
Favor regular json encoding instead of json-ld/normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
bplatz committed Feb 25, 2025
1 parent d55adde commit b53ed38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/clj/fluree/db/json_ld/commit_data.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
(:require [fluree.crypto :as crypto]
[fluree.db.flake :as flake]
[fluree.db.util.core :as util :refer [get-first get-first-value try* catch*]]
[fluree.db.util.json :as json]
[fluree.db.util.log :as log]
[fluree.json-ld :as json-ld]
[fluree.db.constants :as const]
[fluree.db.json-ld.iri :as iri]
[fluree.db.query.fql.parse :as q-parse]
Expand Down Expand Up @@ -247,14 +247,14 @@
(defn commit-json->commit-id
[jld]
(let [b32-hash (-> jld
json-ld/normalize-data
json/stringify-UTF8
(crypto/sha2-256 :base32))]
(str "fluree:commit:sha256:b" b32-hash)))

(defn db-json->db-id
[payload]
(let [hsh (-> payload
json-ld/normalize-data
json/stringify-UTF8
(crypto/sha2-256 :base32))]
(str "fluree:db:sha256:b" hsh)))

Expand Down
3 changes: 2 additions & 1 deletion src/clj/fluree/db/storage.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[clojure.pprint :as pprint]
[fluree.db.util.async :refer [<? go-try]]
[fluree.db.util.bytes :as bytes]
[fluree.db.util.json :as json]
[fluree.json-ld :as json-ld])
#?(:clj (:import (java.io Writer))))

Expand Down Expand Up @@ -115,7 +116,7 @@
(defn content-write-json
[store path data]
(go-try
(let [json (json-ld/normalize-data data)
(let [json (json/stringify data)
bytes (bytes/string->UTF8 json)
result (<? (-content-write-bytes store path bytes))]
(assoc result :json json))))
Expand Down

0 comments on commit b53ed38

Please sign in to comment.