app/controllers/cms/content_controller.rb in browsercms-3.1.5 vs app/controllers/cms/content_controller.rb in browsercms-3.3.0.beta
- old
+ new
@@ -49,12 +49,12 @@
cache_page if perform_caching
end
# ----- Before Filters -------------------------------------------------------
def construct_path
- @paths = params[:page_path] || params[:path] || []
- @path = "/#{@paths.join("/")}"
+ @path = "/#{params[:path]}"
+ @paths = @path.split("/")
end
def construct_path_from_route
@_page_route = PageRoute.find(params[:_page_route_id])
@path = @_page_route.page.path
@@ -88,11 +88,11 @@
true
end
def try_to_redirect
if redirect = Redirect.find_by_from_path(@path)
- redirect_to redirect.to_path, :status=>:moved_permanently
+ redirect_to redirect.to_path
end
end
def try_to_stream_file
split = @paths.last.to_s.split('.')
@@ -109,10 +109,11 @@
#Construct a path to where this file would be if it were cached
@file = @attachment.full_file_location
#Stream the file if it exists
if @path != "/" && File.exists?(@file)
+ logger.warn "Sending file #{@file}"
send_file(@file,
:filename => @attachment.file_name,
:type => @attachment.file_type,
:disposition => "inline"
)
@@ -123,10 +124,10 @@
end
def check_access_to_page
set_page_mode
if current_user.able_to?(:edit_content, :publish_content, :administrate)
- logger.info "..... Displaying draft version of page"
+ logger.debug "Displaying draft version of page"
if page = Page.first(:conditions => {:path => @path})
@page = page.as_of_draft_version
else
return render(:layout => 'cms/application',
:template => 'cms/content/no_page',