add allow_other_host: true to redirect_to to avoid raising ActionController::Redirecting::UnsafeRedirectError

Exemple:
https://github.com/openfoodfoundation/openfoodnetwork/actions/runs/8281744847/job/22660933543?pr=12209#step:10:158
Reference:
https://blog.saeloun.com/2022/02/08/rails-7-raise-unsafe-redirect-error/
This commit is contained in:
Mohamed ABDELLANI
2024-03-15 00:36:53 +01:00
parent 5552177691
commit 45f94ea2d0
2 changed files with 2 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ module PaymentGateways
# At this point Paypal has *provisionally* accepted that the payment can now be placed,
# and the user will be redirected to a Paypal payment page. On completion, the user is
# sent back and the response is handled in the #confirm action in this controller.
redirect_to provider.express_checkout_url(pp_response, useraction: 'commit')
redirect_to provider.express_checkout_url(pp_response, useraction: 'commit'), allow_other_host: true
else
flash[:error] =
Spree.t(

View File

@@ -63,7 +63,7 @@ module Spree
Bugsnag.notify(e)
flash[:error] = e.message
ensure
redirect_to request.referer
redirect_to request.referer, allow_other_host: true
end
def paypal_refund