solo descargar los sourcemaps remotos a través de conexiones seguras

This commit is contained in:
f 2021-03-22 16:25:18 -03:00
parent f356793908
commit 5f87540de7

View file

@ -28,7 +28,7 @@ class BacktraceJob < ApplicationJob
# Encuentra el código fuente del error
source = data.dig('sourcesContent', data['sources']&.index(backtrace['file']))&.split("\n")
backtrace['function'] = source.dig(backtrace['line'] - 1) if source.present?
backtrace['function'] = source[backtrace['line'] - 1] if source.present?
end
end
end
@ -67,6 +67,8 @@ class BacktraceJob < ApplicationJob
# @param [String] La URL del map
# @return [Hash]
def data(map)
return {} unless map.start_with? 'https://'
map += '.map' unless map.end_with? '.map'
@data ||= {}
@ -85,7 +87,7 @@ class BacktraceJob < ApplicationJob
def sourcemap
@sourcemap ||=
begin
sources.map { |x| "#{x}.map" }.map do |map|
sources.map do |map|
SourceMap::Map.from_hash data(map)
rescue Down::Error, FastJsonparser::Error
SourceMap::Map.new