Skip to content

Commit 33c8891

Browse files
committed
Simplify
1 parent 3ba345a commit 33c8891

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

lib/storage_reader.rb

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,11 @@ def get_ethscription_with_content(tx_hash, block_tag: 'latest')
105105
ethscription_data = decoded[0]
106106
content_data = decoded[1]
107107

108-
# Derive media_type and mime_subtype from mimetype
109-
mimetype = ethscription_data[6] # mimetype is at index 6
110-
media_type, mime_subtype = mimetype.split('/', 2) if mimetype
111-
112108
{
113109
# Content fields
114110
content_uri_hash: '0x' + ethscription_data[0].unpack1('H*'),
115111
content_sha: '0x' + ethscription_data[1].unpack1('H*'),
116-
mimetype: mimetype,
117-
media_type: media_type,
118-
mime_subtype: mime_subtype,
112+
mimetype: ethscription_data[6], # mimetype at index 6
119113
esip6: ethscription_data[9], # bool at index 9
120114

121115
# Main fields
@@ -161,17 +155,11 @@ def get_ethscription(tx_hash, block_tag: 'latest')
161155
# The struct is returned as an array
162156
ethscription_data = decoded[0]
163157

164-
# Derive media_type and mime_subtype from mimetype
165-
mimetype = ethscription_data[6] # mimetype is at index 6
166-
media_type, mime_subtype = mimetype.split('/', 2) if mimetype
167-
168158
{
169159
# Content fields
170160
content_uri_hash: '0x' + ethscription_data[0].unpack1('H*'),
171161
content_sha: '0x' + ethscription_data[1].unpack1('H*'),
172-
mimetype: mimetype,
173-
media_type: media_type,
174-
mime_subtype: mime_subtype,
162+
mimetype: ethscription_data[6], # mimetype at index 6
175163
esip6: ethscription_data[9], # bool at index 9
176164

177165
# Main fields

spec/integration/ethscriptions_creation_spec.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,6 @@
530530
# Verify content fields
531531
expect(stored[:content]).to eq("<svg>test</svg>")
532532
expect(stored[:mimetype]).to eq("image/svg+xml")
533-
expect(stored[:media_type]).to eq("image")
534-
expect(stored[:mime_subtype]).to eq("svg+xml")
535533

536534
# Verify content URI hash
537535
expected_hash = Digest::SHA256.hexdigest(content_uri)
@@ -553,8 +551,6 @@
553551
stored = get_ethscription_content(results[:ethscription_ids].first)
554552

555553
expect(stored[:mimetype]).to eq("application/json")
556-
expect(stored[:media_type]).to eq("application")
557-
expect(stored[:mime_subtype]).to eq("json")
558554

559555
# Verify content URI hash matches
560556
expected_hash = Digest::SHA256.hexdigest(content_uri)

0 commit comments

Comments
 (0)