14794: Validates workbench2_url config at startup.
[arvados.git] / apps / workbench / app / views / layouts / body.html.erb
index c2ddda8c763015090780c6d130a7652b10038e12..b2cd097f3174c03fa49c7d1f280d7c809ecf280c 100644 (file)
@@ -85,11 +85,11 @@ SPDX-License-Identifier: AGPL-3.0 %>
                 <% if Rails.configuration.workbench2_url %>
                 <li role="menuitem">
                   <%
-                    # Remove any trailing '/'
-                    r = /^(.*?)[\/]*$/
-                    wb2_url = r.match(Rails.configuration.workbench2_url)[1]
+                    wb2_url = Rails.configuration.workbench2_url
+                    wb2_url += '/' if wb2_url[-1] != '/'
+                    wb2_url += 'token'
                   %>
-                  <form action="<%= wb2_url %>/token" method="GET">
+                  <form action="<%= wb2_url %>" method="GET">
                     <input type="hidden" name="api_token" value="<%= Thread.current[:arvados_api_token] %>">
                     <button role="menuitem" type="submit">
                       <i class="fa fa-lg fa-share-square fa-fw"></i> Go to Workbench 2