Skip to content

Vue file list doesn't work for repository URLs without /-/

Sample URL: https://gitlab.com/gitlab-data/analytics/tree/master/

image__1_

Notice that the files are not rendered below the commit info

For repository URLs, we are supporting both URLs with and without /-/ to support clients that don't follow redirects (like cURL). Background in #118840 (closed)

Possible fix

diff --git a/app/assets/javascripts/repository/router.js b/app/assets/javascripts/repository/router.js
index 6c31c9bae82..a4dba5d88d1 100644
--- a/app/assets/javascripts/repository/router.js
+++ b/app/assets/javascripts/repository/router.js
@@ -12,7 +12,7 @@ export default function createRouter(base, baseRef) {
     base: joinPaths(gon.relative_url_root || '', base),
     routes: [
       {
-        path: `/-/tree/${escape(baseRef)}(/.*)?`,
+        path: `/(-/)?tree/${escape(baseRef)}(/.*)?`,
         name: 'treePath',
         component: TreePage,
         props: route => ({