unpoly-rails 3.7.2 → 3.7.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -103,11 +103,17 @@ module Unpoly
103
103
  def parse(raw)
104
104
  result = Util.guard_json_decode(raw, &@default)
105
105
 
106
- if result.is_a?(::Hash)
107
- result = ActiveSupport::HashWithIndifferentAccess.new(result)
106
+ # A client might have sent valid JSON but not a JSON object.
107
+ # E.g. an array, number or string.
108
+ unless result.is_a?(::Hash)
109
+ if raw.present?
110
+ ::Rails.logger.error('unpoly-rails: Unexpected JSON value in X-Up header')
111
+ end
112
+
113
+ result = {}
108
114
  end
109
115
 
110
- result
116
+ ActiveSupport::HashWithIndifferentAccess.new(result)
111
117
  end
112
118
 
113
119
  def stringify(value)
@@ -3,6 +3,6 @@ module Unpoly
3
3
  ##
4
4
  # The current version of the unpoly-rails gem.
5
5
  # The first 3 digits should match the version of the Unpoly frontend code.
6
- VERSION = '3.7.2'
6
+ VERSION = '3.7.3.1'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unpoly-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.2
4
+ version: 3.7.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-11 00:00:00.000000000 Z
11
+ date: 2024-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties