alphagov/whitehall — pull request #650 by tekin (2013-07-09 09:44:55+00:00)
Title: Add rake task to repair attachment filenames

Tracker: https://www.pivotaltracker.com/story/show/48166823

The rake task leverages DataHygiene::DocumentAttachmentRepairer to repair any documents that have attachments with double (or more!) extensions. It employs a different strategy, depending on the state
of the document (i.e. draft, published or published with a new draft).

There will be instances where the task cannot update a particular document:

* If the file in question is not on the file system
* If the edition is not valid when trying to save it
* If the edition has become stale because it is in use elsewhere

In each case, an error or warning will be output and the task will continue. The task is also idempotent, so can be re-run any number of times.

NOTE: This will be run after the data migration that repairs some invalid publications: https://github.com/alphagov/whitehall/pull/649