From 5f87540de7b202ec9a3bc7056b8136a5be5f34ef Mon Sep 17 00:00:00 2001 From: f Date: Mon, 22 Mar 2021 16:25:18 -0300 Subject: [PATCH] =?UTF-8?q?solo=20descargar=20los=20sourcemaps=20remotos?= =?UTF-8?q?=20a=20trav=C3=A9s=20de=20conexiones=20seguras?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/backtrace_job.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/jobs/backtrace_job.rb b/app/jobs/backtrace_job.rb index fa8ee79..4f0eb63 100644 --- a/app/jobs/backtrace_job.rb +++ b/app/jobs/backtrace_job.rb @@ -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