From: Tom Hughes Date: Sun, 4 Nov 2012 14:35:34 +0000 (+0000) Subject: Use binary mode for trace files X-Git-Tag: live~5830 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/cb6eb65466b9c744f5c9601c0d00b10b8b051fe1 Use binary mode for trace files We don't want to try and do any enoding conversions (or indeed any newline conversions) on uploaded trace files. --- diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 05f97bf0d..4b138bdae 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -368,7 +368,7 @@ private filename = "/tmp/#{rand}" # ...and save the uploaded file to that location - File.open(filename, "w") { |f| f.write(file.read) } + File.open(filename, "wb") { |f| f.write(file.read) } # Create the trace object, falsely marked as already # inserted to stop the import daemon trying to load it