ankane / mailkick

Email subscriptions for Rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ActiveSupport::MessageVerifier::InvalidSignature

chamnap opened this issue · comments

Currently, there is an issue when this exception is raised, it continues to render the actual view, and it breaks the app. It's because @options is nil when called oped_out? from the view.
It should halt the execution, however.

screen shot 2018-04-16 at 10 35 53 am

https://github.com/ankane/mailkick/blob/master/app/controllers/mailkick/subscriptions_controller.rb#L35
I see you already rescue this exception with the below code. However, it doesn't work for me on my rails app 5.1. (It works on rails 5.0.x)

render text: "Subscription not found", status: :bad_request

If I changed it to the below code, it works well.

render file: 'public/404.html', layout: false, status: 404

@ankane, Any thoughts?

Alright, I found it.

DEPRECATION WARNING: render :text is deprecated because it does not actually render a text/plain response. Switch to render plain: 'plain text' to render as text/plain, render html: '<strong>HTML</strong>' to render as text/html, or render body: 'raw' to match the deprecated behavior and render with the default Content-Type, which is text/html.

Changed it to the below, and it will fix the issue:

render plain: "Subscription not found", status: :bad_request

Would you like me to submit a PR? Doing a check with render :text or render :plain?

Hey @chamnap, thanks for reporting 👍 Fixed on master.