diff --git a/app/models/theme.rb b/app/models/theme.rb index fbb2e39..3a7278d 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -111,7 +111,7 @@ class Theme def add_image(filename, data) FileUtils.mkdir_p(images_directory) - File.open(image_path(filename), 'w') do |f| + File.open(image_path(filename), 'wb') do |f| f.write(data) end end diff --git a/test/functional/themes_controller_test.rb b/test/functional/themes_controller_test.rb index b22e8eb..e0c8cbd 100644 --- a/test/functional/themes_controller_test.rb +++ b/test/functional/themes_controller_test.rb @@ -216,7 +216,7 @@ class ThemesControllerTest < ActionController::TestCase post :add_image, :profile => 'testinguser', :id => 'mytheme', :image => fixture_file_upload('/files/rails.png', 'image/png', :binary) assert_redirected_to :action => "edit", :id => 'mytheme' assert theme.image_files.include?('rails.png') - assert(system('diff', Rails.root.join('test', 'fixtures', 'files','rails.png'), TMP_THEMES_DIR + '/mytheme/images/rails.png'), 'should put the correct uploaded file in the right place') + assert(system('diff', Rails.root.join('test', 'fixtures', 'files','rails.png').to_s, TMP_THEMES_DIR.join('mytheme/images/rails.png').to_s), 'should put the correct uploaded file in the right place') end should 'link to "test theme"' do -- libgit2 0.21.2