app/helpers/requests_helper.rb
# maybe we were sent a referer in params, otherwise we do our
# best to come up with something reasonable.
maybe we were sent a referer in params, otherwise we do our
best to come up with something reasonable.
maybe we were sent a referer in params otherwise we do our best to come up with something reasonable .
def request_done_path
    if params["referer"]
      begin
        u = URI.parse(params["referer"])
        u.host = nil
        u.scheme = nil
        url = u.to_s
        return url if url.starts_with?( root_path )
      rescue Exception => e
        logger.warn("Referer is not a legit url?: #{e.inspect}\n    HTTP User-Agent:    #{request.headers["User-Agent"]}\n    HTTP Referer: #{request.headers["Referer"]}")
      end
    end
    if @ils_request && @ils_request.bib_id
      return solr_document_path("bib_#{@ils_request.bib_id}")
    end
    return search_catalog_path
  end
def request_done_path if params [ "referer" ] begin u = URI . parse ( params [ "referer" ] ) u . host = nil u . scheme = nil url = u . to_s return url if url . starts_with? ( root_path ) rescue Exception => e logger . warn ( "Referer is not a legit url?: #{e.inspect}\n    HTTP User-Agent:    #{request.headers["User-Agent"]}\n    HTTP Referer: #{request.headers["Referer"]}" ) end end if @ils_request && @ils_request . bib_id return solr_document_path ( "bib_#{@ils_request.bib_id}" ) end return search_catalog_path end
maybe we were sent a referer in params, otherwise we do our
best to come up with something reasonable.
maybe we were sent a referer in params otherwise we do our best to come up with something reasonable .
# for security, we make sure it's a partial URL that is internal # to our app.