From 74525161153a618c444a9198212641de1bf53318 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Fri, 31 Mar 2017 23:25:45 +0200 Subject: [PATCH] Fix exporter --- lib/exporter.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/exporter.rb b/lib/exporter.rb index 035bf064..7d3dda30 100644 --- a/lib/exporter.rb +++ b/lib/exporter.rb @@ -81,7 +81,12 @@ class Exporter target_file = "/tmp/rs_export/#{@export_dirname}/pictures/picture_#{s}_#{@user.profile_picture_file_name}" File.open target_file, 'wb' do |f| f.binmode - f.write HTTParty.get(url).parsed_response + data = if url.start_with?('/system') + File.read(Rails.root.join('public', url) + else + HTTParty.get(url).parsed_response + end + f.write data end end end @@ -92,7 +97,12 @@ class Exporter target_file = "/tmp/rs_export/#{@export_dirname}/pictures/header_#{s}_#{@user.profile_header_file_name}" File.open target_file, 'wb' do |f| f.binmode - f.write HTTParty.get(url).parsed_response + data = if url.start_with?('/system') + File.read(Rails.root.join('public', url) + else + HTTParty.get(url).parsed_response + end + f.write data end end end