From 893d79f7fd2e7be63c765103026100ac8d5daec3 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 8 Dec 2020 18:51:41 -0300 Subject: [PATCH] =?UTF-8?q?un=20poco=20m=C3=A1s=20robusto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/notices_controller.rb | 3 ++- app/jobs/backtrace_job.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/notices_controller.rb b/app/controllers/api/v1/notices_controller.rb index bd2bcaad..cf2e2140 100644 --- a/app/controllers/api/v1/notices_controller.rb +++ b/app/controllers/api/v1/notices_controller.rb @@ -28,10 +28,11 @@ module Api def site @site ||= Site.find(params[:site_id]) + rescue ActiveRecord::RecordNotFound end def verify_api_key - site.verifier.verify(airbrake_token, purpose: :airbrake) === Site::Api::AIRBRAKE_SECRET + site&.verifier&.verify(airbrake_token, purpose: :airbrake) === Site::Api::AIRBRAKE_SECRET rescue ActiveSupport::MessageVerifier::InvalidSignature false end diff --git a/app/jobs/backtrace_job.rb b/app/jobs/backtrace_job.rb index a7192fdc..9138039e 100644 --- a/app/jobs/backtrace_job.rb +++ b/app/jobs/backtrace_job.rb @@ -40,7 +40,7 @@ class BacktraceJob < ApplicationJob # Obtiene todos los archivos del backtrace def files - @files ||= params['errors'].map { |x| x['backtrace'] }.flatten.map { |x| x['file'].split('@').last }.uniq.select { |x| x.start_with? site.url } + @files ||= params['errors'].map { |x| x['backtrace'] }.flatten.map { |x| x['file'].split('@').last }.uniq.select { |x| x&.start_with?(site.url) } end # Asume que todos los sourcemaps comparten la misma URL, lo