mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Fix rubocop issues (#14715)
This commit is contained in:
@ -10,7 +10,7 @@ class ImportScripts::JForum < ImportScripts::Base
|
||||
def initialize
|
||||
super
|
||||
|
||||
@settings = YAML.load(File.read(ARGV.first), symbolize_names: true)
|
||||
@settings = YAML.safe_load(File.read(ARGV.first), symbolize_names: true)
|
||||
|
||||
@database_client = Mysql2::Client.new(
|
||||
host: @settings[:database][:host],
|
||||
|
@ -48,7 +48,7 @@ module ImportScripts::Mbox
|
||||
if File.exist?(metadata_file)
|
||||
# workaround for YML files that contain classname in file header
|
||||
yaml = File.read(metadata_file).sub(/^--- !.*$/, '---')
|
||||
metadata = YAML.load(yaml)
|
||||
metadata = YAML.safe_load(yaml)
|
||||
else
|
||||
metadata = {}
|
||||
end
|
||||
|
@ -180,7 +180,7 @@ class ImportScripts::NodeBB < ImportScripts::Base
|
||||
if is_external
|
||||
# download external image
|
||||
begin
|
||||
string_io = open(picture, read_timeout: 5)
|
||||
string_io = uri.open(read_timeout: 5)
|
||||
rescue Net::ReadTimeout
|
||||
puts "timeout downloading avatar for user #{imported_user.id}"
|
||||
return nil
|
||||
@ -246,7 +246,7 @@ class ImportScripts::NodeBB < ImportScripts::Base
|
||||
|
||||
if is_external
|
||||
begin
|
||||
string_io = open(picture, read_timeout: 5)
|
||||
string_io = uri.open(read_timeout: 5)
|
||||
rescue Net::ReadTimeout
|
||||
return nil
|
||||
end
|
||||
|
@ -558,7 +558,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
||||
|
||||
def read_smf_settings
|
||||
settings = File.join(self.smfroot, 'Settings.php')
|
||||
IO.readlines(settings).each do |line|
|
||||
File.readlines(settings).each do |line|
|
||||
next unless m = /\$([a-z_]+)\s*=\s*['"](.+?)['"]\s*;\s*((#|\/\/).*)?$/.match(line)
|
||||
case m[1]
|
||||
when 'db_server' then self.host ||= m[2]
|
||||
|
@ -333,7 +333,7 @@ class ImportScripts::ZendeskApi < ImportScripts::Base
|
||||
attempts = 0
|
||||
|
||||
begin
|
||||
open("#{$1}") do |image|
|
||||
URI.parse(image_url).open do |image|
|
||||
# IMAGE_DOWNLOAD_PATH is whatever image, it will be replaced with the downloaded image
|
||||
File.open(IMAGE_DOWNLOAD_PATH, "wb") do |file|
|
||||
file.write(image.read)
|
||||
|
Reference in New Issue
Block a user