Skip to content

Commit

Permalink
Quifix for null byte char in string
Browse files Browse the repository at this point in the history
  • Loading branch information
tdroxler committed Jan 20, 2025
1 parent 080a979 commit 284c733
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,14 @@ object TokenQueries extends StrictLogging {
def insertNFTMetadata(
metadata: NFTMetadata
): DBActionW[Int] = {
val cleanedTokenUri = metadata.tokenUri.replaceAll("\u0000", "")
sqlu"""
INSERT INTO nft_metadata (
"token",
"token_uri",
"collection_id",
"nft_index"
)
VALUES (${metadata.id},${cleanedTokenUri},${metadata.collectionId},${metadata.nftIndex})
VALUES (${metadata.id},${metadata.tokenUri},${metadata.collectionId},${metadata.nftIndex})
ON CONFLICT
DO NOTHING
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ object BlockFlowClient extends StrictLogging {
def valToString(value: api.model.Val): Option[String] =
value match {
case api.model.ValByteVec(bytes) =>
Some(bytes.utf8String)
Some(bytes.utf8String.replaceAll("\u0000", ""))
case _ => None
}

Expand Down

0 comments on commit 284c733

Please sign in to comment.