这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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('/').reject(&:blank?).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