aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/incoming_message.rb14
-rw-r--r--config/packages1
-rw-r--r--todo.txt2
3 files changed, 16 insertions, 1 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 8aaaa66e6..3abf38f3f 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -17,7 +17,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: incoming_message.rb,v 1.74 2008-04-14 15:45:01 francis Exp $
+# $Id: incoming_message.rb,v 1.75 2008-04-14 23:12:36 francis Exp $
# TODO
@@ -433,6 +433,18 @@ class IncomingMessage < ActiveRecord::Base
text += File.read(tempfile.path + ".txt") + "\n\n"
File.unlink(tempfile.path + ".txt")
tempfile.close
+ elsif attachment.content_type == 'application/msexcel'
+ # Bit crazy using catdoc - but xls2csv, xlhtml and py_xls2txt
+ # only extract text from cells, not from floating notes. catdoc
+ # may be fooled by weird character sets, but will probably do for
+ # UK FOI requests.
+ tempfile = Tempfile.new('foixls')
+ tempfile.print attachment.body
+ tempfile.flush
+ IO.popen("/usr/bin/catdoc " + tempfile.path, "r") do |child|
+ text += child.read() + "\n\n"
+ end
+ tempfile.close
elsif attachment.content_type == 'application/pdf'
tempfile = Tempfile.new('foipdf')
tempfile.print attachment.body
diff --git a/config/packages b/config/packages
index 1e6d100d4..8e175f24e 100644
--- a/config/packages
+++ b/config/packages
@@ -1,2 +1,3 @@
wv
poppler-utils
+catdoc
diff --git a/todo.txt b/todo.txt
index ae2809143..923b25dfc 100644
--- a/todo.txt
+++ b/todo.txt
@@ -29,6 +29,8 @@ Next
====
Link more clearly to full request and next/previous correspondence (ask Matthew)
+ Perhaps always redirect to internal # links from the /response/ pages
+e.g. http://www.flickr.com/groups/central/discuss/72157604494352123/72157604515433851/
Check date order here
http://www.whatdotheyknow.com/track/feed/5