{"action":"created","issue":{"url":"https://api.github.com/repos/mysociety/alaveteli/issues/3253","repository_url":"https://api.github.com/repos/mysociety/alaveteli","labels_url":"https://api.github.com/repos/mysociety/alaveteli/issues/3253/labels{/name}","comments_url":"https://api.github.com/repos/mysociety/alaveteli/issues/3253/comments","events_url":"https://api.github.com/repos/mysociety/alaveteli/issues/3253/events","html_url":"https://github.com/mysociety/alaveteli/issues/3253","id":154998204,"number":3253,"title":"[ERROR] request#get_attachment_as_html (Errno::EEXIST) \"File exists…\"","user":{"login":"garethrees","id":282788,"avatar_url":"https://avatars.githubusercontent.com/u/282788?v=3","gravatar_id":"","url":"https://api.github.com/users/garethrees","html_url":"https://github.com/garethrees","followers_url":"https://api.github.com/users/garethrees/followers","following_url":"https://api.github.com/users/garethrees/following{/other_user}","gists_url":"https://api.github.com/users/garethrees/gists{/gist_id}","starred_url":"https://api.github.com/users/garethrees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garethrees/subscriptions","organizations_url":"https://api.github.com/users/garethrees/orgs","repos_url":"https://api.github.com/users/garethrees/repos","events_url":"https://api.github.com/users/garethrees/events{/privacy}","received_events_url":"https://api.github.com/users/garethrees/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-16T10:03:01Z","updated_at":"2016-05-16T10:05:25Z","closed_at":null,"body":"```\r\nAn Errno::EEXIST occurred in request#get_attachment_as_html:\r\n\r\nFile exists - /APP_ROOT/www.whatdotheyknow.com/alaveteli-2016-05-16T07-44-32/cache/views/cy/request/306/306198/response/763090/attach/html\r\n/usr/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir'\r\n\r\n\r\n-------------------------------\r\nRequest:\r\n-------------------------------\r\n\r\n* URL : https://www.whatdotheyknow.com/cy/request/306198/response/763090/attach/html/2/P%202013%201064.INSTALLATION%20OF%20A%20SINGLE%20WIND%20TURBINE%2024.8M%20TO%20HUB%20AND%2034.5M%20TO%20BLADE%20TIP.pdf.html\r\n* HTTP Method: GET\r\n* IP address : [FILTERED]\r\n* Parameters : {\"controller\"=>\"request\", \"action\"=>\"get_attachment_as_html\", \"id\"=>\"306198\", \"incoming_message_id\"=>\"763090\", \"part\"=>\"2\", \"file_name\"=>\"P 2013 1064.INSTALLATION OF A SINGLE WIND TURBINE 24.8M TO HUB AND 34.5M TO BLADE TIP.pdf.html\", \"locale\"=>\"cy\"}\r\n* Timestamp : 2016-05-16 10:53:47 +0100\r\n* Server : [FILTERED]\r\n* Rails root : /APP_ROOT/www.whatdotheyknow.com/alaveteli-2016-05-16T07-44-32\r\n* Process: 20027\r\n\r\n-------------------------------\r\nSession:\r\n-------------------------------\r\n\r\n* session id: [FILTERED]\r\n* data: {\"session_id\"=>\"[FILTERED]\",\r\n\"locale\"=>\"cy\",\r\n\"remember_me\"=>false,\r\n\"_csrf_token\"=>\"[FILTERED]\",\r\n\"request_game\"=>2016-02-22 10:49:32 +0000,\r\n\"user_id\"=>60565,\r\n\"ttl\"=>2016-05-16 10:01:21 +0100,\r\n\"post_redirect_token\"=>\"[FILTERED]\"}\r\n\r\n-------------------------------\r\nEnvironment:\r\n-------------------------------\r\n\r\n* HTTP_ACCEPT : text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\n* HTTP_ACCEPT_ENCODING : gzip\r\n* HTTP_ACCEPT_LANGUAGE : en-US,en;q=0.8\r\n* HTTP_COOKIE : ; last_request_id=334751; last_body_id=; _wdtk_cookie_session=[FILTERED]\r\n* HTTP_DNT : 1\r\n* HTTP_HOST : www.whatdotheyknow.com\r\n* HTTP_UPGRADE_INSECURE_REQUESTS : 1\r\n* HTTP_USER_AGENT : Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36\r\n* HTTP_VERSION : HTTP/1.1\r\n* HTTP_X_FORWARDED_FOR : [FILTERED]\r\n* HTTP_X_FORWARDED_PROTO : https\r\n* HTTP_X_REAL_IP : [FILTERED]\r\n* HTTP_X_SENDFILE_TYPE : X-Sendfile\r\n* HTTP_X_VARNISH : 289476295\r\n* ORIGINAL_FULLPATH : /cy/request/306198/response/763090/attach/html/2/P%202013%201064.INSTALLATION%20OF%20A%20SINGLE%20WIND%20TURBINE%2024.8M%20TO%20HUB%20AND%2034.5M%20TO%20BLADE%20TIP.pdf.html\r\n* PASSENGER_CONNECT_PASSWORD : [FILTERED]\r\n* PATH_INFO : /cy/request/306198/response/763090/attach/html/2/P%202013%201064.INSTALLATION%20OF%20A%20SINGLE%20WIND%20TURBINE%2024.8M%20TO%20HUB%20AND%2034.5M%20TO%20BLADE%20TIP.pdf.html\r\n* QUERY_STRING :\r\n* REMOTE_ADDR : [FILTERED]\r\n* REMOTE_PORT : 38970\r\n* REQUEST_METHOD : GET\r\n* REQUEST_URI : /cy/request/306198/response/763090/attach/html/2/P%202013%201064.INSTALLATION%20OF%20A%20SINGLE%20WIND%20TURBINE%2024.8M%20TO%20HUB%20AND%2034.5M%20TO%20BLADE%20TIP.pdf.html\r\n* SCRIPT_NAME :\r\n* SCRIPT_URI : http://www.whatdotheyknow.com/cy/request/306198/response/763090/attach/html/2/P 2013 1064.INSTALLATION OF A SINGLE WIND TURBINE 24.8M TO HUB AND 34.5M TO BLADE TIP.pdf.html\r\n* SCRIPT_URL : /cy/request/306198/response/763090/attach/html/2/P 2013 1064.INSTALLATION OF A SINGLE WIND TURBINE 24.8M TO HUB AND 34.5M TO BLADE TIP.pdf.html\r\n* SERVER_NAME : www.whatdotheyknow.com\r\n* SERVER_PORT : 80\r\n* SERVER_PROTOCOL : HTTP/1.1\r\n* SERVER_SOFTWARE : Apache/2.2.22 (Debian) mod_fastcgi/mod_fastcgi-SNAP-0910052141 Phusion_Passenger/5.0.26\r\n* action_controller.instance : #<RequestController:0x0000000b186fb8>\r\n* action_dispatch.backtrace_cleaner : #<Rails::BacktraceCleaner:0x00000003e74188>\r\n* action_dispatch.cookies : #<ActionDispatch::Cookies::CookieJar:0x0000000b180e38>\r\n* action_dispatch.logger : #<ActiveSupport::TaggedLogging:0x00000002dbce58>\r\n* action_dispatch.parameter_filter : [:password, /RAW_POST_DATA/]\r\n* action_dispatch.remote_ip : [FILTERED]\r\n* action_dispatch.request.content_type :\r\n* action_dispatch.request.formats : [text/html]\r\n* action_dispatch.request.parameters : {\"controller\"=>\"request\", \"action\"=>\"get_attachment_as_html\", \"id\"=>\"306198\", \"incoming_message_id\"=>\"763090\", \"part\"=>\"2\", \"file_name\"=>\"P 2013 1064.INSTALLATION OF A SINGLE WIND TURBINE 24.8M TO HUB AND 34.5M TO BLADE TIP.pdf.html\", \"locale\"=>\"cy\"}\r\n* action_dispatch.request.path_parameters : {:controller=>\"request\", :action=>\"get_attachment_as_html\", :id=>\"306198\", :incoming_message_id=>\"763090\", :part=>\"2\", :file_name=>\"P 2013 1064.INSTALLATION OF A SINGLE WIND TURBINE 24.8M TO HUB AND 34.5M TO BLADE TIP.pdf.html\", :locale=>\"cy\"}\r\n* action_dispatch.request.query_parameters : {}\r\n* action_dispatch.request.request_parameters : {}\r\n* action_dispatch.request.unsigned_session_cookie: {\"session_id\"=>\"[FILTERED]\", \"locale\"=>\"en\", \"remember_me\"=>false, \"_csrf_token\"=>\"[FILTERED]\", \"request_game\"=>2016-02-22 10:49:32 +0000, \"user_id\"=>60565, \"ttl\"=>2016-05-16 10:01:21 +0100, \"post_redirect_token\"=>\"[FILTERED]\"}\r\n* action_dispatch.request_id : 6ee06d21d70897837f7c69373730ce6f\r\n* action_dispatch.routes : #<ActionDispatch::Routing::RouteSet:0x00000002947080>\r\n* action_dispatch.secret_token : [FILTERED]\r\n* action_dispatch.show_detailed_exceptions : false\r\n* action_dispatch.show_exceptions : true\r\n* newrelic.transaction_started : true\r\n* rack.errors : #<IO:0x00000001aeb220>\r\n* rack.hijack : #<Proc:0x0000000b172770@/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:84 (lambda)>\r\n* rack.hijack? : true\r\n* rack.input : #<PhusionPassenger::Utils::TeeInput:0x0000000b172978>\r\n* rack.multiprocess : true\r\n* rack.multithread : false\r\n* rack.request.cookie_hash : {\"last_request_id\"=>\"334751\", \"last_body_id\"=>\"\", \"_wdtk_cookie_session\"=>\"[FILTERED]\"}\r\n* rack.request.cookie_string : ; last_request_id=334751; last_body_id=; _wdtk_cookie_session=[FILTERED]\r\n* rack.request.query_hash : {}\r\n* rack.request.query_string :\r\n* rack.run_once : false\r\n* rack.session : {\"session_id\"=>\"[FILTERED]\", \"locale\"=>\"cy\", \"remember_me\"=>false, \"_csrf_token\"=>\"[FILTERED]\", \"request_game\"=>2016-02-22 10:49:32 +0000, \"user_id\"=>60565, \"ttl\"=>2016-05-16 10:01:21 +0100, \"post_redirect_token\"=>\"[FILTERED]\"}\r\n* rack.session.options : {:path=>\"/\", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>\"[FILTERED]\", :coder=>#<Rack::Session::Cookie::Base64::Marshal:0x000000060fb6c0>, :id=>\"[FILTERED]\"}\r\n* rack.url_scheme : http\r\n* rack.version : [1, 2]\r\n\r\n-------------------------------\r\nBacktrace:\r\n-------------------------------\r\n\r\n/usr/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir'\r\n/usr/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'\r\n/usr/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'\r\n/usr/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'\r\n/usr/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'\r\n/usr/lib/ruby/1.9.1/fileutils.rb:205:in `each'\r\n/usr/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'\r\napp/controllers/request_controller.rb:612:in `get_attachment_as_html'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_controller/metal/implicit_render.rb:4:in `send_action'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/abstract_controller/base.rb:167:in `process_action'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_controller/metal/rendering.rb:10:in `process_action'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/abstract_controller/callbacks.rb:18:in `block in process_action'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:614:in `block (2 levels) in _run__189810607882237211__process_action__2487138069390189173__callbacks'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_1352'\r\napp/controllers/request_controller.rb:562:in `cache_attachments'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_1352'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:613:in `block in _run__189810607882237211__process_action__2487138069390189173__callbacks'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_1351'\r\napp/controllers/application_controller.rb:105:in `record_memory'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_1351'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:601:in `_run__189810607882237211__process_action__2487138069390189173__callbacks'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:405:in `__run_callback'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:81:in `run_callbacks'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/abstract_controller/callbacks.rb:17:in `process_action'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_controller/metal/rescue.rb:29:in `process_action'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/notifications.rb:123:in `block in instrument'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/notifications.rb:123:in `instrument'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_controller/metal/instrumentation.rb:29:in `process_action'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'\r\nvendor/bundle/ruby/1.9.1/gems/activerecord-3.2.22.2/lib/active_record/railties/controller_runtime.rb:18:in `process_action'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:30:in `block in process_action'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:362:in `perform_action_with_newrelic_trace'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:29:in `process_action'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/abstract_controller/base.rb:121:in `process'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/abstract_controller/rendering.rb:45:in `process'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_controller/metal.rb:203:in `dispatch'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_controller/metal.rb:246:in `block in action'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/routing/route_set.rb:73:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/routing/route_set.rb:36:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'\r\nvendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'\r\nvendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/routing/route_set.rb:608:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/exception_notification-4.0.1/lib/exception_notification/rack.rb:28:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/rack-1.4.7/lib/rack/etag.rb:23:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/rack-1.4.7/lib/rack/conditionalget.rb:25:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/head.rb:14:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/params_parser.rb:21:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/flash.rb:242:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/rack-1.4.7/lib/rack/session/abstract/id.rb:210:in `context'\r\nvendor/bundle/ruby/1.9.1/gems/rack-1.4.7/lib/rack/session/abstract/id.rb:205:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/cookies.rb:341:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/rack-ssl-1.3.4/lib/rack/ssl.rb:27:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nlib/strip_empty_sessions.rb:13:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/activerecord-3.2.22.2/lib/active_record/query_cache.rb:64:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/activerecord-3.2.22.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:405:in `_run__485947210659674793__call__3586948820140778583__callbacks'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:405:in `__run_callback'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb:81:in `run_callbacks'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/callbacks.rb:27:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/railties-3.2.22.2/lib/rails/rack/logger.rb:32:in `call_app'\r\nvendor/bundle/ruby/1.9.1/gems/railties-3.2.22.2/lib/rails/rack/logger.rb:16:in `block in call'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/tagged_logging.rb:22:in `tagged'\r\nvendor/bundle/ruby/1.9.1/gems/railties-3.2.22.2/lib/rails/rack/logger.rb:16:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/request_id.rb:22:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/rack-1.4.7/lib/rack/methodoverride.rb:21:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/rack-1.4.7/lib/rack/runtime.rb:17:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/cache/strategy/local_cache.rb:72:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/rack-1.4.7/lib/rack/lock.rb:15:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/static.rb:83:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/rack-utf8_sanitizer-1.3.2/lib/rack/utf8_sanitizer.rb:19:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/railties-3.2.22.2/lib/rails/engine.rb:484:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/railties-3.2.22.2/lib/rails/application.rb:231:in `call'\r\nvendor/bundle/ruby/1.9.1/gems/railties-3.2.22.2/lib/rails/railtie/configurable.rb:30:in `method_missing'\r\nvendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'\r\n/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'\r\n/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:152:in `accept_and_process_next_request'\r\n/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'\r\n/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'\r\n/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'\r\n```"},"comment":{"url":"https://api.github.com/repos/mysociety/alaveteli/issues/comments/219391607","html_url":"https://github.com/mysociety/alaveteli/issues/3253#issuecomment-219391607","issue_url":"https://api.github.com/repos/mysociety/alaveteli/issues/3253","id":219391607,"user":{"login":"garethrees","id":282788,"avatar_url":"https://avatars.githubusercontent.com/u/282788?v=3","gravatar_id":"","url":"https://api.github.com/users/garethrees","html_url":"https://github.com/garethrees","followers_url":"https://api.github.com/users/garethrees/followers","following_url":"https://api.github.com/users/garethrees/following{/other_user}","gists_url":"https://api.github.com/users/garethrees/gists{/gist_id}","starred_url":"https://api.github.com/users/garethrees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garethrees/subscriptions","organizations_url":"https://api.github.com/users/garethrees/orgs","repos_url":"https://api.github.com/users/garethrees/repos","events_url":"https://api.github.com/users/garethrees/events{/privacy}","received_events_url":"https://api.github.com/users/garethrees/received_events","type":"User","site_admin":false},"created_at":"2016-05-16T10:05:25Z","updated_at":"2016-05-16T10:05:25Z","body":"This was caused by visiting a \"view attachment as HTML\" URL.\r\n\r\nFor some reason, the `html` directory was created as a file:\r\n\r\n```\r\n$ tree attach/\r\nattach/\r\n├── 2\r\n│   └── P%202013%201064.INSTALLATION%20OF%20A%20SINGLE%20WIND%20TURBINE%2024.8M%20TO%20HUB%20AND%2034.5M%20TO%20BLADE%20TIP.pdf\r\n└── html\r\n\r\n$ ls -al /[FILTERED]/www.whatdotheyknow.com/alaveteli-2016-05-16T07-44-32/cache/views/cy/request/306/306198/response/763090/attach/html/\r\nls: cannot access /data/vhost/www.whatdotheyknow.com/alaveteli-2016-05-16T07-44-32/cache/views/cy/request/306/306198/response/763090/attach/html/: Not a directory\r\n```\r\n\r\nI deleted the `html` file and visited the URL again to regenerate the attachment, which worked successfully. Here's what the directory tree _should_ look like:\r\n\r\n```\r\n$ tree attach/\r\nattach/\r\n├── 2\r\n│   └── P%202013%201064.INSTALLATION%20OF%20A%20SINGLE%20WIND%20TURBINE%2024.8M%20TO%20HUB%20AND%2034.5M%20TO%20BLADE%20TIP.pdf\r\n└── html\r\n    └── 2\r\n        ├── foiextract20160516-19797-1fwap4d-1_1.jpg\r\n        ├── foiextract20160516-19797-1fwap4d-2_1.jpg\r\n        ├── foiextract20160516-19797-1fwap4d-3_1.jpg\r\n        ├── foiextract20160516-19797-1fwap4d-3_2.jpg\r\n        └── P%202013%201064.INSTALLATION%20OF%20A%20SINGLE%20WIND%20TURBINE%2024.8M%20TO%20HUB%20AND%2034.5M%20TO%20BLADE%20TIP.pdf.html\r\n\r\n3 directories, 6 files\r\n```"}}