diff --git a/core/lib/refinery/application_controller.rb b/core/lib/refinery/application_controller.rb
index <HASH>..<HASH> 100644
--- a/core/lib/refinery/application_controller.rb
+++ b/core/lib/refinery/application_controller.rb
@@ -56,7 +56,7 @@ module Refinery
       end
 
       def home_page?
-        main_app.root_path =~ /^#{request.path}\/?/
+        main_app.root_path =~ /^#{Regexp.escape(request.path)}\/?/
       end
 
       def just_installed?
home_page?(): Escape special characters in request.path

Prevents an exception being thrown when the request path evaluates to an
invalid regular expression (i.e. unmatched brackets). This should also
fix a possible security issue in the sense that we were previously
permitting a user to define an arbitrarily complex regex inside the
application.