unpoly-rails 3.3.0 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/unpoly/unpoly-bootstrap3.js +3 -3
- data/assets/unpoly/unpoly-bootstrap3.min.js +1 -1
- data/assets/unpoly/unpoly-bootstrap4.js +3 -3
- data/assets/unpoly/unpoly-bootstrap4.min.js +1 -1
- data/assets/unpoly/unpoly-bootstrap5.js +3 -3
- data/assets/unpoly/unpoly-bootstrap5.min.js +1 -1
- data/assets/unpoly/unpoly-migrate.js +118 -28
- data/assets/unpoly/unpoly-migrate.min.js +1 -1
- data/assets/unpoly/unpoly.es6.js +2102 -1786
- data/assets/unpoly/unpoly.es6.min.js +1 -1
- data/assets/unpoly/unpoly.js +2132 -1826
- data/assets/unpoly/unpoly.min.js +1 -1
- data/lib/unpoly/rails/change/field.rb +5 -15
- data/lib/unpoly/rails/util.rb +14 -2
- data/lib/unpoly/rails/version.rb +2 -3
- metadata +2 -2
@@ -48,7 +48,7 @@ module Unpoly
|
|
48
48
|
end
|
49
49
|
|
50
50
|
##
|
51
|
-
# An array of strings,
|
51
|
+
# An array of strings, separated by a space character.
|
52
52
|
class SeparatedValues < Field
|
53
53
|
|
54
54
|
def initialize(name, separator: ' ', default: nil)
|
@@ -60,8 +60,8 @@ module Unpoly
|
|
60
60
|
def parse(raw)
|
61
61
|
if raw
|
62
62
|
raw.split(@separator)
|
63
|
-
|
64
|
-
|
63
|
+
else
|
64
|
+
@default&.call
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -101,11 +101,7 @@ module Unpoly
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def parse(raw)
|
104
|
-
|
105
|
-
result = Util.json_decode(raw)
|
106
|
-
elsif @default
|
107
|
-
result = instance_exec(&@default)
|
108
|
-
end
|
104
|
+
result = Util.guard_json_decode(raw, &@default)
|
109
105
|
|
110
106
|
if result.is_a?(::Hash)
|
111
107
|
result = ActiveSupport::HashWithIndifferentAccess.new(result)
|
@@ -132,13 +128,7 @@ module Unpoly
|
|
132
128
|
end
|
133
129
|
|
134
130
|
def parse(raw)
|
135
|
-
|
136
|
-
result = Util.json_decode(raw)
|
137
|
-
elsif @default
|
138
|
-
result = instance_exec(&@default)
|
139
|
-
end
|
140
|
-
|
141
|
-
result
|
131
|
+
Util.guard_json_decode(raw, &@default)
|
142
132
|
end
|
143
133
|
|
144
134
|
def stringify(value)
|
data/lib/unpoly/rails/util.rb
CHANGED
@@ -3,8 +3,20 @@ module Unpoly
|
|
3
3
|
class Util
|
4
4
|
class << self
|
5
5
|
|
6
|
-
def
|
7
|
-
|
6
|
+
def guard_json_decode(raw, &default)
|
7
|
+
if raw.present?
|
8
|
+
begin
|
9
|
+
ActiveSupport::JSON.decode(raw)
|
10
|
+
rescue ActiveSupport::JSON.parse_error
|
11
|
+
# We would love to crash here, as it might indicate a bug in the frontend code.
|
12
|
+
# Unfortunately security scanners may be spamming malformed JSON in X-Up headers,
|
13
|
+
# DOSing us with error notifications.
|
14
|
+
::Rails.logger.error('unpoly-rails: Ignoring malformed JSON in X-Up header')
|
15
|
+
default&.call
|
16
|
+
end
|
17
|
+
else
|
18
|
+
default&.call
|
19
|
+
end
|
8
20
|
end
|
9
21
|
|
10
22
|
# We build a lot of JSON that goes into HTTP header.
|
data/lib/unpoly/rails/version.rb
CHANGED
@@ -2,8 +2,7 @@ module Unpoly
|
|
2
2
|
module Rails
|
3
3
|
##
|
4
4
|
# The current version of the unpoly-rails gem.
|
5
|
-
#
|
6
|
-
|
7
|
-
VERSION = '3.3.0'
|
5
|
+
# The first 3 digits should match the version of the Unpoly frontend code.
|
6
|
+
VERSION = '3.5.0'
|
8
7
|
end
|
9
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.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|