File tree Expand file tree Collapse file tree 5 files changed +25
-98
lines changed
Expand file tree Collapse file tree 5 files changed +25
-98
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ gem "memoist", "~> 0.16.2"
6565
6666gem "awesome_print" , "~> 1.9"
6767
68+ gem 'facet_rails_common' , git : 'https://github.com/0xfacet/facet_rails_common.git'
6869
6970gem "redis" , "~> 5.0"
7071
Original file line number Diff line number Diff line change 1414 rbsecp256k1 (~> 6.0 )
1515 scrypt (~> 3.0 )
1616
17+ GIT
18+ remote: https://github.com/0xfacet/facet_rails_common.git
19+ revision: 2d5cf107df9ea12bb7ab59a8b1ce4d38b4de483b
20+ specs:
21+ facet_rails_common (0.1.0 )
22+ order_query (~> 0.5.3 )
23+
1724GEM
1825 remote: https://rubygems.org/
1926 specs:
216223 bigdecimal (>= 3.0 )
217224 ostruct (>= 0.2 )
218225 openssl (3.3.0 )
226+ order_query (0.5.5 )
227+ activerecord (>= 5.0 , < 8.1 )
228+ activesupport (>= 5.0 , < 8.1 )
219229 ostruct (0.6.3 )
220230 parallel (1.27.0 )
221231 parser (3.2.2.4 )
@@ -406,6 +416,7 @@ DEPENDENCIES
406416 debug
407417 dotenv-rails (~> 2.8 )
408418 eth !
419+ facet_rails_common !
409420 fastlz (~> 0.1.0 )
410421 httparty (~> 0.22.0 )
411422 jwt (~> 2.8 )
Original file line number Diff line number Diff line change @@ -101,7 +101,12 @@ def extract(content_uri)
101101 begin
102102 # Parse JSON (preserves key order)
103103 # Use DataUri to correctly handle optional parameters like ESIP6
104- json_str = DataUri . new ( content_uri ) . decoded_data
104+ json_str = if content_uri . start_with? ( "data:,{" )
105+ content_uri . sub ( /\A data:,/ , '' )
106+ else
107+ DataUri . new ( content_uri ) . decoded_data
108+ end
109+
105110 # TODO: make sure this is safe
106111 data = JSON . parse ( json_str )
107112
Original file line number Diff line number Diff line change @@ -26,8 +26,11 @@ def extract(content_uri)
2626 return DEFAULT_PARAMS unless valid_data_uri? ( content_uri )
2727 begin
2828 # Extract JSON from data URI using DataUri to support optional params (e.g., ESIP6)
29- json_str = DataUri . new ( content_uri ) . decoded_data
30-
29+ json_str = if content_uri . start_with? ( "data:,{" )
30+ content_uri . sub ( /\A data:,/ , '' )
31+ else
32+ DataUri . new ( content_uri ) . decoded_data
33+ end
3134 # Parse with security checks
3235 data = parse_json_safely ( json_str )
3336
@@ -57,6 +60,8 @@ def valid_data_uri?(uri)
5760 return false unless uri . is_a? ( String )
5861 return false unless DataUri . valid? ( uri )
5962
63+ return true if uri . start_with? ( "data:,{" )
64+
6065 # Ensure the payload is JSON (starts with '{')
6166 begin
6267 payload = DataUri . new ( uri ) . decoded_data
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments