diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-01-17 14:25:12 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-01-17 14:25:12 +0000 |
commit | 7e7757661aa4be4e38ffa1fd7aa96a36700f2cf4 (patch) | |
tree | efe3773b0804a8b5d98660cd4412af170662b647 | |
parent | 701c8987063419956e9dd4dc6d57d9e27e7d91f3 (diff) |
Call uudecode via AlaveteliExternalCommand
So do not rely on a hard-coded path. Also change the order of arguments
and use /dev/stdout rather than -, so it works with the Mac/BSD version
of uudecode as well as the Linux version.
-rw-r--r-- | app/models/incoming_message.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 2186d50dc..69a125770 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -738,9 +738,7 @@ class IncomingMessage < ActiveRecord::Base tempfile = Tempfile.new('foiuu') tempfile.print uu tempfile.flush - IO.popen("/usr/bin/uudecode " + tempfile.path + " -o -", "r") do |child| - content = child.read() - end + content = AlaveteliExternalCommand("uudecode", "-o", "/dev/stdout", tempfile.path) tempfile.close # Make attachment type from it, working out filename and mime type filename = uu.match(/^begin\s+[0-9]+\s+(.*)$/)[1] |