Skip to content

Commit 23d73c3

Browse files
author
Ben Lavender
committed
Raise an error if a trailing slash is on the auth base url
1 parent 45bac4c commit 23d73c3

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/chatops/controller.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ def ensure_chatops_authenticated
112112
end
113113

114114
def ensure_valid_chatops_url
115-
raise ConfigurationError.new("You need to set the server's base URL to authenticate chatops RPC via #{ChatOps.auth_base_url_env_var_name}") unless ChatOps.auth_base_url.present?
115+
unless ChatOps.auth_base_url.present?
116+
raise ConfigurationError.new("You need to set the server's base URL to authenticate chatops RPC via #{ChatOps.auth_base_url_env_var_name}")
117+
end
118+
if ChatOps.auth_base_url[-1] == "/"
119+
raise ConfigurationError.new("Don't include a trailing slash in #{ChatOps.auth_base_url_env_var_name}; the rails path will be appended and it must match exactly.")
120+
end
116121
@chatops_url = ChatOps.auth_base_url + request.path
117122
end
118123

0 commit comments

Comments
 (0)