un poco más robusto
This commit is contained in:
parent
695f12ad0f
commit
893d79f7fd
2 changed files with 3 additions and 2 deletions
|
@ -28,10 +28,11 @@ module Api
|
||||||
|
|
||||||
def site
|
def site
|
||||||
@site ||= Site.find(params[:site_id])
|
@site ||= Site.find(params[:site_id])
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_api_key
|
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
|
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,7 +40,7 @@ class BacktraceJob < ApplicationJob
|
||||||
|
|
||||||
# Obtiene todos los archivos del backtrace
|
# Obtiene todos los archivos del backtrace
|
||||||
def files
|
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
|
end
|
||||||
|
|
||||||
# Asume que todos los sourcemaps comparten la misma URL, lo
|
# Asume que todos los sourcemaps comparten la misma URL, lo
|
||||||
|
|
Loading…
Reference in a new issue