Created
September 10, 2010 15:32
-
-
Save JonRowe/573842 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From c389e8dabd9bf6c5ede8191eb6c453407b92442b Mon Sep 17 00:00:00 2001 | |
From: Jon Rowe <mail@jonrowe.co.uk> | |
Date: Fri, 10 Sep 2010 16:28:23 +0100 | |
Subject: [PATCH] write in binmode if the object is binary encoded | |
--- | |
lib/dragonfly/temp_object.rb | 1 + | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
diff --git a/lib/dragonfly/temp_object.rb b/lib/dragonfly/temp_object.rb | |
index 31ff7d7..3f89063 100644 | |
--- a/lib/dragonfly/temp_object.rb | |
+++ b/lib/dragonfly/temp_object.rb | |
@@ -58,6 +58,7 @@ module Dragonfly | |
@tempfile = initialized_tempfile | |
when :data | |
@tempfile = Tempfile.new('dragonfly') | |
+ @tempfile.binmode if (initialized_data.respond_to?(:encoding) && initalized_data.encoding == Encoding::ASCII_8BIT) | |
@tempfile.write(initialized_data) | |
when :file | |
@tempfile = copy_to_tempfile(initialized_file.path) | |
-- | |
1.7.2.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment