diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/request_controller.rb | 9 | ||||
-rw-r--r-- | app/models/profile_photo.rb | 2 | ||||
-rw-r--r-- | app/models/public_body.rb | 16 |
3 files changed, 10 insertions, 17 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 96c501755..7ca081c04 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # app/controllers/request_controller.rb: # Show information about one particular request. # @@ -137,6 +138,8 @@ class RequestController < ApplicationController @per_page = 25 @page = (params[:page] || "1").to_i @info_request = InfoRequest.find_by_url_title(params[:url_title]) + raise ActiveRecord::RecordNotFound.new("Request not found") if @info_request.nil? + if !@info_request.user_can_view?(authenticated_user) render :template => 'request/hidden', :status => 410 # gone return @@ -146,7 +149,7 @@ class RequestController < ApplicationController if (@page > 1) @page_desc = " (page " + @page.to_s + ")" - else + else @page_desc = "" end end @@ -688,7 +691,7 @@ class RequestController < ApplicationController # we don't use @attachment.content_type here, as we want same mime type when cached in cache_attachments above response.content_type = AlaveteliFileTypes.filename_to_mimetype(params[:file_name].join("/")) || 'application/octet-stream' - + headers["Content-Disposition"] = "attachment; filename=#{params[:file_name]}" render :text => @attachment.body end @@ -843,7 +846,7 @@ class RequestController < ApplicationController logger.error("Could not convert info request #{info_request.id} to PDF with command '#{convert_command} #{url} #{tempfile.path}'") end tempfile.close - else + else logger.warn("No HTML -> PDF converter found at #{convert_command}") end if !done diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb index 43dbbbf0a..798094d90 100644 --- a/app/models/profile_photo.rb +++ b/app/models/profile_photo.rb @@ -17,8 +17,6 @@ # # $Id: profile_photo.rb,v 1.2 2009-09-17 21:10:05 francis Exp $ # -require 'mahoro' -require 'RMagick' class ProfilePhoto < ActiveRecord::Base WIDTH = 96 diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 961fa3cbb..a18af8c69 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -282,19 +282,11 @@ class PublicBody < ActiveRecord::Base # Guess home page from the request email, or use explicit override, or nil # if not known. def calculated_home_page - # manual override for ones we calculate wrongly - if self.home_page != '' - return self.home_page + if home_page && !home_page.empty? + home_page[URI::regexp(%w(http https))] ? home_page : "http://#{home_page}" + elsif request_email_domain + "http://www.#{request_email_domain}" end - - # extract the domain name from the FOI request email - url = self.request_email_domain - if url.nil? - return nil - end - - # add standard URL prefix - return "http://www." + url end # Are all requests to this body under the Environmental Information Regulations? |