avo 3.30.2 → 3.30.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a17bd5d64c6fd414881870b8be0a2931760b73fe27584d79b89d4e4b7646e7a
4
- data.tar.gz: 314c446cca23dc08ad254bd0f04df648832b53a7f48e7d538dd1bccdf395518f
3
+ metadata.gz: cd6222805c1fb419248e68b029cd5b9dec91b0d2faccf403d6f1ad39ce2a96f2
4
+ data.tar.gz: fa3ff35952311e35121b928d89dbc9c9d7e613ee96465b83a1c106ad9c2eb342
5
5
  SHA512:
6
- metadata.gz: fcf5f063eddacec4a7298837b1200e400acb86034f5c469a4c56adc7fa5e087b464c2ed5ee1a56a924368c88dd30b1012bbc7b3a13ed8b5d2cae3d319e34e62a
7
- data.tar.gz: f4c58d1f4806ff77e0a73885a6bb2e491b6f55f4e45a66dfb345665e290b093b2571c6b03f6b3bfaa62ee2f13bde21761ee4b263dae7e19eacae5234d1101468
6
+ metadata.gz: f47c3579be975550a03d97c5451d9a3911ecc71ba473a9e8b9897ffd6130d5e0e694ffe7f68573c58fe4a56da267cb58e7230f44f5fa5c5fa5b39b19e6e0cbcf
7
+ data.tar.gz: a9b8729b81e5d8487738aa22c2298ae3e809089892e4116f1c23b25cfc52941a2207619a21c6f70db64741a682641f46ba9792dfa10769a2de3edc576a6c3823
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (3.30.2)
4
+ avo (3.30.3)
5
5
  actionview (>= 6.1)
6
6
  active_link_to
7
7
  activerecord (>= 6.1)
@@ -4,5 +4,5 @@
4
4
  <%= hidden_field_tag :via_record_id, params[:via_record_id] if params[:via_record_id] %>
5
5
  <%= hidden_field_tag :via_relation, params[:via_relation] if params[:via_relation] %>
6
6
  <%= hidden_field_tag :via_belongs_to_resource_class, params[:via_belongs_to_resource_class] if params[:via_belongs_to_resource_class] %>
7
- <%= hidden_field_tag :return_to, params[:return_to] if params[:return_to].present? %>
7
+ <%= hidden_field_tag :return_to, e(params[:return_to]) if params[:return_to].present? %>
8
8
  <%= hidden_field_tag :referrer, @back_path if params[:via_resource_class] %>
@@ -57,7 +57,7 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent
57
57
  # When coming from a turbo frame, we don't want to return to that exact frame
58
58
  # for example when editing a has_one field we want to return to the parent frame
59
59
  # not the frame of the has_one field.
60
- args[:return_to] = request.url unless request.url.include?("turbo_frame=")
60
+ args[:return_to] = e(request.fullpath) unless request.url.include?("turbo_frame=")
61
61
 
62
62
  helpers.edit_resource_path(record: @resource.record, resource: @resource, **args)
63
63
  end
@@ -326,7 +326,6 @@ module Avo
326
326
 
327
327
  def decode_params
328
328
  if params[:return_to].present?
329
- params[:raw_return_to] = params[:return_to]
330
329
  params[:return_to] = d(params[:return_to])
331
330
  end
332
331
  end
@@ -546,7 +546,9 @@ module Avo
546
546
  return nil if @resource.class.send(action).blank?
547
547
 
548
548
  extra_args = {}
549
- extra_args[:return_to] = params[:return_to] if params[:return_to].present?
549
+ if params[:return_to].present?
550
+ extra_args[:return_to] = e(params[:return_to])
551
+ end
550
552
 
551
553
  if @resource.class.send(action) == :index
552
554
  resources_path(resource: @resource, **extra_args)
@@ -161,14 +161,16 @@ module Avo
161
161
 
162
162
  # encode & encrypt params
163
163
  def e(value)
164
- Avo::Services::EncryptionService.encrypt(message: value, purpose: :return_to, serializer: Marshal)
164
+ encrypted = Avo::Services::EncryptionService.encrypt(message: value, purpose: :return_to, serializer: Marshal)
165
+ Base64.urlsafe_encode64(encrypted, padding: false)
165
166
  end
166
167
 
167
168
  # decrypt & decode params
168
169
  def d(value)
169
- Avo::Services::EncryptionService.decrypt(message: value, purpose: :return_to, serializer: Marshal)
170
+ decoded = Base64.urlsafe_decode64(value.to_s)
171
+ Avo::Services::EncryptionService.decrypt(message: decoded, purpose: :return_to, serializer: Marshal)
170
172
  rescue
171
- value
173
+ nil
172
174
  end
173
175
 
174
176
  private
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.30.2" unless const_defined?(:VERSION)
2
+ VERSION = "3.30.3" unless const_defined?(:VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.30.2
4
+ version: 3.30.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin