5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-13 07:21:42 +00:00

un poco más robusto

This commit is contained in:
f 2020-12-08 18:51:41 -03:00
parent 695f12ad0f
commit 893d79f7fd
2 changed files with 3 additions and 2 deletions

View file

@ -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

View file

@ -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