aboutsummaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeLines
* Add extra debug linehotfix/0.11.0.7Louise Crow2013-06-10-0/+1
|
* Fix syntax errors, add some debug output.Louise Crow2013-06-10-8/+22
|
* Add a task for cleaning up user accounts that were created with a space in ↵Louise Crow2013-06-10-0/+65
| | | | the email address.
* Remove old temp tasks.Louise Crow2013-06-10-50/+0
|
* Backport ruby 1.9 fix for trailing = sign in message headers from mail 2.5release/0.11Louise Crow2013-06-04-0/+16
|
* Parse the 'to' address as if on a real mail to trigger quoted string encoding.Louise Crow2013-06-03-1/+3
|
* Fix for subject lines with invalid UTF-8 as the last characterMark Longair2013-06-03-2/+12
| | | | | | | | | | | | | | | This seems to be the bug mentioned here: http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/ That explains that some versions of Iconv don't ignore invalid characters when converting to UTF-8 even with //IGNORE if that invalid character happens to be at the end of the string. In fact, as Matthew Somerville pointed out, with some versions of iconv (e.g. 1.14 on Mac OS, apparently) it's necessary to add and remove more than one space at the end, in case the first character of the byte sequence indicates a long sequence. We add and remove 4 to be on the safe side.
* Remove the (we think) now unneeded will_paginate customizationMark Longair2013-05-29-59/+0
| | | | | | | | We believe that this customization is no longer needed, and in any case would need to be rewritten for will_paginate 3.0.4. If any pagination bugs do arise, a test should be added that reproduces that problem, since currently the tests pass without this extension.
* Merge branch 'tmail-to-mail-tests' into rails-3-developMark Longair2013-05-28-12/+303
|\ | | | | | | | | | | | | | | This merge brings in a number of tests and fixes for the handling of mail under Mail / Rails 3 instead of TMail / Rails 2. Conflicts: config/initializers/alaveteli.rb
| * Suppress STDERR noise from the tnef binaryMark Longair2013-05-22-1/+1
| |
| * Move the mapi requires to where they're really neededMark Longair2013-05-22-0/+2
| | | | | | | | | | | | | | Handling of outlook-packed attachments would fail from rake tasks or in the console without requiring 'mapi/msg' and 'mapi/convert' beforehand. Instead, require them in the source file where they're actually used.
| * Retain old handling of malformed addresses in To and Cc linesMark Longair2013-05-21-0/+29
| | | | | | | | | | | | | | | | | | | | The behaviour of the TMail backend's 'to' and 'cc' methods where there was a malformed To: or Cc: line was to return nil, whereas Mail returns a version of the string anyway. We'd have to change quite a lot of code to deal with an extra possible class of returned objects, so it's simplest for the moment to monkey-patch Mail::Message's 'to' and 'cc' methods to restore the old behaviour.
| * Cope with emails with a missing final MIME boundaryMark Longair2013-05-17-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Mail gem deals with multipart messages that look as if they should have 1 part but are missing the final MIME boundary, by make the parts list empty and setting part.body to the text of the email. Rather than throwing an exception in this case, we just pretend that part is text/plain and return it, so that the page doesn't error and we still have a chance of some useful text being displayed. Note that we haven't investigated yet the case of emails that have more than one start boundary, but no final boundary. Fixes #921
| * Only set original_charset when a charset has been defined for the mail part. ↵Louise Crow2013-05-16-3/+8
| | | | | | | | Fixes #942.
| * Add a helper function for dumping text to diskMark Longair2013-05-16-0/+11
| | | | | | | | | | | | | | This function is useful for investigating problems with handling of emails, attachments and the related character encoding issues. It can safely be removed later, but is currently useful to have for debugging purposes.
| * Make efforts to ensure that we're usually dealing with UTF-8 stringsMark Longair2013-05-16-1/+5
| | | | | | | | | | | | | | | | | | One of these changes is to make sure that the Mail backend, like the TMail backend it replaces, will return text parts encoded in UTF-8 if possible. The other change is to ensure that when text attachments are reloaded from disk, we attempt to convert them to UTF-8.
| * Add functions for converting from arbitrary text data to UTF-8Mark Longair2013-05-16-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Throughout the codebase it is simplest and most consistent if we could assume that all text/* attachments are represented by UTF-8 strings, and this was largely true with the TMail backend which ensured that all returned text parts were in UTF-8. We have to change the replacement Mail-backed to similarly attempt to convert text parts to UTF-8. This commit introduces two functions which are useful for this. The normalize_string_to_utf8 function will try various encodings, either suggested or guessed (with charlock_holmes) to convert the passed string to UTF-8, and if it can't find a suitable encoding will throw an exception. Unfortunately, the current behaviour of the site is that uninterpretable text/* attachments are still passed around and mangled to UTF-8 just before display. To mimic this it's also useful to have the convert_string_to_utf8_or_binary function, which tries to convert the string to UTF-8 with normalize_string_to_utf8, but if that's not possible just returns the original string. (In Ruby 1.9, encoding will be set to UTF-8 or ASCII-8BIT appropriately.)
| * Ignore common TNEF attachment parsing errorsMark Longair2013-05-16-5/+13
| | | | | | | | | | | | | | This also introduces a custom error class so that we don't accidentally catch other problems. Fixes #920
| * Remove an unnecessary use of 'which' in backticksMark Longair2013-05-16-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The use of backticks in `which tnef` means that which(1) is invoked under /bin/sh, and returns the first executable matching 'tnef' in the default PATH for /bin/sh. In this usage, however, Popen also uses /bin/sh to execute the command, which would run that same executable if just a bare 'tnef' were used. In summary, I can't see any reason for the convolution of: IO.popen("#{`which tnef`.chomp} -K -C #{dir}", "wb") do |f| ... over just: IO.popen("tnef -K -C #{dir}", "wb") do |f| ... so switch to the latter.
| * Add rake tasks for checking the parsing of a random sample of emailsMark Longair2013-05-16-0/+150
| | | | | | | | | | | | | | | | | | | | | | | | For the upgrade from Rails 2 to Rails 3, we want to check that existing emails are parsed correctly. One of these tasks (temp:random_attachments_hexdigests) is for dumping a CVS file of details about each attachment, and its hexdigest, and a list of the randomly selected raw emails. (It's intended that you run this on an old Rails 2 install of Alaveteli. The other task (temp:recompute_attachments_hexdigests) is intended to be run on a Rails 3 install of Alaveteli, with the previous files as input, to check that the same results are obtained.
* | Disable referential integrity disabling in the test database, if a config ↵Louise Crow2013-05-28-0/+110
| | | | | | | | param 'constraint_disabling' is set to false in the test section of database.yml, and pay attention to the order in which fixtures are defined when deleting and loading them.
* | Merge remote-tracking branch 'origin/hotfix/0.9.0.3' into rails-3-developLouise Crow2013-05-16-1/+6
|\ \ | |/ |/| | | | | | | | | Conflicts: Rakefile app/models/contact_mailer.rb spec/models/contact_mailer_spec.rb
| * Limit memory available to wvText, which calls elinksIan Chard2013-05-15-1/+2
| |
| * Add option to limit memory available to external commandsIan Chard2013-05-15-0/+4
| |
* | Restore load of config (AlaveteliConfiguration is required in forward_on) - ↵Louise Crow2013-05-08-54/+57
| | | | | | | | update config to avoid redefinition of constant warnings.
* | No need to explicitly load the rake tasks in Rails 3.Louise Crow2013-05-07-4/+0
| |
* | Remove unused function.Louise Crow2013-04-30-18/+0
| |
* | Merge branch 'release/0.9' into rails-3-developLouise Crow2013-04-24-6/+17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Gemfile.lock app/controllers/public_body_controller.rb app/mailers/track_mailer.rb app/views/request/_hidden_correspondence.html.erb app/views/request/_sidebar.html.erb app/views/request/hidden.html.erb app/views/request/new_please_describe.html.erb app/views/request/preview.html.erb app/views/user/show.html.erb config/environment.rb config/routes.rb spec/controllers/public_body_controller_spec.rb
| * Also silence network unreachable errors.Louise Crow2013-04-17-6/+6
| |
| * Merge branch 'feature/final-consistent-translation-interpolation' into developLouise Crow2013-04-16-0/+11
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: app/models/outgoing_message.rb app/views/general/search.rhtml app/views/public_body/list.rhtml app/views/public_body/show.rhtml app/views/public_body/view_email.rhtml app/views/request/_after_actions.rhtml app/views/request/_followup.rhtml app/views/request/_sidebar.rhtml app/views/request/new.rhtml app/views/request/select_authority.rhtml app/views/request/upload_response.rhtml locale/aln/app.po locale/app.pot locale/ar/app.po locale/bs/app.po locale/ca/app.po locale/cs/app.po locale/cy/app.po locale/de/app.po locale/en/app.po locale/en_IE/app.po locale/es/app.po locale/eu/app.po locale/fr/app.po locale/gl/app.po locale/hu_HU/app.po locale/id/app.po locale/nb_NO/app.po locale/pt_BR/app.po locale/ro_RO/app.po locale/sl/app.po locale/sq/app.po locale/sr@latin/app.po locale/tr/app.po locale/uk/app.po
| | * Override n_ to add interpolationMatthew Landauer2013-04-09-0/+11
| | |
* | | Change email address in header of source code to hello@mysociety.orgMatthew Landauer2013-03-26-2/+2
| | |
* | | Merge branch 'develop' into rails-3-developLouise Crow2013-03-19-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: Gemfile Gemfile.lock app/views/admin_request/show.html.erb config/environment.rb
| * | Follow alphabetical ordering.Louise Crow2013-03-19-1/+1
| | |
| * | Allow the emergency user account to be disabled.Louise Crow2013-03-19-0/+1
| | |
* | | Rails security updateMatthew Landauer2013-03-19-67/+0
| | | | | | | | | | | | | | | The rails upgrade also forces a mail gem upgrade. To make things work again we need to remove part of the monkeypatched backporting of encoding fixes.
* | | Remove Rails 2 patch from 1e958d20f674dabde9e8fc6606edc704d4f93b66Henare Degan2013-03-14-19/+0
| | |
* | | Merge remote-tracking branch 'mysociety/develop' into rails-3-developHenare Degan2013-03-14-10/+25
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Gemfile Gemfile.lock app/controllers/admin_request_controller.rb app/controllers/admin_track_controller.rb app/controllers/request_controller.rb app/controllers/services_controller.rb app/helpers/link_to_helper.rb app/mailers/request_mailer.rb app/models/application_mailer.rb app/models/info_request.rb app/views/admin_censor_rule/edit.html.erb app/views/admin_censor_rule/new.html.erb app/views/admin_public_body/_form.html.erb app/views/admin_public_body/_locale_selector.html.erb app/views/admin_public_body/_one_list.html.erb app/views/admin_public_body/edit.html.erb app/views/admin_public_body/list.html.erb app/views/admin_public_body/new.html.erb app/views/admin_request/_incoming_message_actions.html.erb app/views/admin_request/edit.html.erb app/views/admin_request/edit_comment.html.erb app/views/admin_request/edit_outgoing.html.erb app/views/admin_request/list.html.erb app/views/admin_request/list_old_unclassified.html.erb app/views/admin_request/show.html.erb app/views/admin_track/_some_tracks.html.erb app/views/admin_track/list.html.erb app/views/admin_user/edit.html.erb app/views/admin_user/list.html.erb app/views/admin_user/show.html.erb app/views/general/_footer.html.erb app/views/general/exception_caught.html.erb app/views/help/contact.html.erb app/views/layouts/default.html.erb app/views/public_body/_alphabet.html.erb app/views/request/_request_listing_single.html.erb app/views/request/_sidebar.html.erb app/views/request/new.html.erb app/views/request/show.html.erb app/views/request_mailer/external_response.rhtml app/views/request_mailer/fake_response.rhtml config/environment.rb config/environments/production.rb config/routes.rb spec/controllers/admin_censor_rule_controller_spec.rb spec/controllers/request_controller_spec.rb spec/controllers/track_controller_spec.rb spec/helpers/link_to_helper_spec.rb spec/mailers/request_mailer_spec.rb spec/models/info_request_spec.rb spec/spec_helper.rb spec/views/public_body/show.html.erb_spec.rb spec/views/request/show.html.erb_spec.rb vendor/plugins/rails_xss/lib/rails_xss/erubis.rb
| * | Merge remote-tracking branch ↵Louise Crow2013-03-13-0/+24
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'openaustralia_github/one_support_email_on_admin_attention_state' into develop Conflicts: Gemfile.lock app/controllers/request_controller.rb app/models/request_mailer.rb app/views/admin_general/index.rhtml spec/models/request_mailer_spec.rb
| | * | Fix bug in rails 2 cookiestore that only shows up when using integration testsMatthew Landauer2013-03-06-0/+19
| | | |
| | * | Extract method that knows who can update the state of a requestMatthew Landauer2013-03-03-0/+5
| | | |
| * | | Merge remote-tracking branch 'openaustralia_github/force-ssl' into developLouise Crow2013-03-12-0/+1
| |\ \ \ | | | | | | | | | | | | | | | | | | | | Conflicts: Gemfile.lock
| | * | | Add configuration to force ssl for the whole siteMatthew Landauer2013-02-15-0/+1
| | |/ /
| * | | Remove monkeypatch that makes tag helper html4 compliantMatthew Landauer2013-03-07-8/+0
| | | |
| * | | Configurations ADMIN_BASE_URL and ADMIN_PUBLIC_URL are no longer used anywhereMatthew Landauer2013-02-15-2/+0
| |/ /
* | | Backport Mail's encoding code from 2.5 for Ruby 1.9Henare Degan2013-03-07-0/+45
| | | | | | | | | | | | Decoding messages in Ruby 1.9 was screwing up but not dying like 1.8. Backporting this fixes the problem.
* | | See how we go not disabling this nowHenare Degan2013-03-03-21/+0
| | |
* | | Rename Configuration class to avoid conflict with ActiveSupport::ConfigurableHenare Degan2013-03-03-10/+10
| | |
* | | Different class in newer version of will_paginateHenare Degan2013-03-03-1/+1
| | |
* | | Revert "Update this to match the older version of the mail gem we're using"Henare Degan2013-03-03-1/+2
| | | | | | | | | | | | This reverts commit b9a2d996408c1ef703aa78311f8c2a0f6e0d7afc.