Skip to content

Commit

Permalink
Merge 21c49c7 into cd8dfdc
Browse files Browse the repository at this point in the history
  • Loading branch information
Obi-TOB committed Jul 27, 2018
2 parents cd8dfdc + 21c49c7 commit ff798f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pages/lib/refinery/pages/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Pages
:cache_pages_full, :layout_template_whitelist,
:use_layout_templates, :page_title, :absolute_page_links, :types,
:auto_expand_admin_tree, :show_title_in_body,
:friendly_id_reserved_words, :layout_templates_pattern, :view_templates_pattern,
:friendly_id_reserved_words, :reserved_paths, :layout_templates_pattern, :view_templates_pattern,
:add_whitelist_elements, :add_whitelist_attributes, :whitelist_elements, :whitelist_attributes,
:home_page_path

Expand Down Expand Up @@ -61,9 +61,10 @@ def layout_template_whitelist
self.absolute_page_links = false
self.types = Types.registered
self.auto_expand_admin_tree = true
self.reserved_paths = %w(/rails/active_storage)
self.friendly_id_reserved_words = %w(
index new session login logout users refinery admin images
)
) + self.reserved_paths.map { |path| (path.split('/') - [""]).first}.flatten.uniq
self.layout_templates_pattern = 'app', 'views', '{layouts,refinery/layouts}', '*html*'
self.view_templates_pattern = 'app', 'views', '{pages,refinery/pages}', '*html*'
end
Expand Down
3 changes: 2 additions & 1 deletion pages/lib/refinery/pages/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class Engine < ::Rails::Engine

def append_marketable_routes
Refinery::Core::Engine.routes.append do
get '*path', :to => 'pages#show', :as => :marketable_page
get '*path', :to => 'pages#show', :as => :marketable_page,
constraints: lambda { |request| !Refinery::Pages.config.reserved_paths.any? { |path| request.path.start_with?(path) } }
end
end

Expand Down
6 changes: 6 additions & 0 deletions pages/spec/controllers/refinery/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,11 @@ module Refinery
expect(response).to render_template("show")
end
end

describe "#show" do
it "does not interfere with active storage" do
expect(:get => "/rails/active_storage").not_to be_routable
end
end
end
end

0 comments on commit ff798f5

Please sign in to comment.