summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-20 22:40:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-20 22:40:25 +0000
commit20abacca26d629e533c41e98600d903be8d13441 (patch)
tree7f879eefe36f0426f181b29cddbb9816e747d1e0
parent8bdbf220176b3c4df35dbf01da3dc8b2d507f351 (diff)
downloadgitlab-ce-20abacca26d629e533c41e98600d903be8d13441.tar.gz
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
-rw-r--r--app/assets/javascripts/repository/components/breadcrumbs.vue4
-rw-r--r--app/assets/javascripts/repository/components/table/parent_row.vue3
-rw-r--r--app/assets/javascripts/repository/components/table/row.vue2
-rw-r--r--app/assets/javascripts/repository/router.js2
-rw-r--r--spec/features/projects/files/user_browses_files_spec.rb28
-rw-r--r--spec/frontend/repository/router_spec.js17
6 files changed, 43 insertions, 13 deletions
diff --git a/app/assets/javascripts/repository/components/breadcrumbs.vue b/app/assets/javascripts/repository/components/breadcrumbs.vue
index fdd6b4eb87a..d78b2d9d962 100644
--- a/app/assets/javascripts/repository/components/breadcrumbs.vue
+++ b/app/assets/javascripts/repository/components/breadcrumbs.vue
@@ -108,14 +108,14 @@ export default {
return acc.concat({
name,
path,
- to: `/-/tree/${joinPaths(encodeURIComponent(this.ref), path)}`,
+ to: `/-/tree/${joinPaths(escapeFileUrl(this.ref), path)}`,
});
},
[
{
name: this.projectShortPath,
path: '/',
- to: `/-/tree/${encodeURIComponent(this.ref)}/`,
+ to: `/-/tree/${escapeFileUrl(this.ref)}/`,
},
],
);
diff --git a/app/assets/javascripts/repository/components/table/parent_row.vue b/app/assets/javascripts/repository/components/table/parent_row.vue
index 32bdda2e0a8..0a8ee5f2fc5 100644
--- a/app/assets/javascripts/repository/components/table/parent_row.vue
+++ b/app/assets/javascripts/repository/components/table/parent_row.vue
@@ -1,5 +1,6 @@
<script>
import { GlLoadingIcon } from '@gitlab/ui';
+import { escapeFileUrl } from '~/lib/utils/url_utility';
export default {
components: {
@@ -28,7 +29,7 @@ export default {
return splitArray.map(p => encodeURIComponent(p)).join('/');
},
parentRoute() {
- return { path: `/-/tree/${encodeURIComponent(this.commitRef)}/${this.parentPath}` };
+ return { path: `/-/tree/${escapeFileUrl(this.commitRef)}/${this.parentPath}` };
},
},
methods: {
diff --git a/app/assets/javascripts/repository/components/table/row.vue b/app/assets/javascripts/repository/components/table/row.vue
index d9ef6eec6f1..6bd1c702a82 100644
--- a/app/assets/javascripts/repository/components/table/row.vue
+++ b/app/assets/javascripts/repository/components/table/row.vue
@@ -99,7 +99,7 @@ export default {
computed: {
routerLinkTo() {
return this.isFolder
- ? { path: `/-/tree/${encodeURIComponent(this.ref)}/${escapeFileUrl(this.path)}` }
+ ? { path: `/-/tree/${escapeFileUrl(this.ref)}/${escapeFileUrl(this.path)}` }
: null;
},
isFolder() {
diff --git a/app/assets/javascripts/repository/router.js b/app/assets/javascripts/repository/router.js
index d74447dd566..b2636f910fe 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/(${encodeURIComponent(baseRef)}|${baseRef})/:path*`,
+ path: `(/-)?/tree/(${encodeURIComponent(baseRef).replace(/%2F/g, '/')}|${baseRef})/:path*`,
name: 'treePath',
component: TreePage,
props: route => ({
diff --git a/spec/features/projects/files/user_browses_files_spec.rb b/spec/features/projects/files/user_browses_files_spec.rb
index 5364bc10b2f..5c52abaeb62 100644
--- a/spec/features/projects/files/user_browses_files_spec.rb
+++ b/spec/features/projects/files/user_browses_files_spec.rb
@@ -180,6 +180,20 @@ describe "User browses files" do
expect(page).to have_content("VERSION")
.and have_content(".gitignore")
.and have_content("LICENSE")
+
+ click_link("files")
+
+ page.within('.repo-breadcrumb') do
+ expect(page).to have_link('files')
+ end
+
+ click_link("html")
+
+ page.within('.repo-breadcrumb') do
+ expect(page).to have_link('html')
+ end
+
+ expect(page).to have_link('500.html')
end
end
@@ -193,6 +207,20 @@ describe "User browses files" do
expect(page).to have_content("VERSION")
.and have_content(".gitignore")
.and have_content("LICENSE")
+
+ click_link("files")
+
+ page.within('.repo-breadcrumb') do
+ expect(page).to have_link('files')
+ end
+
+ click_link("html")
+
+ page.within('.repo-breadcrumb') do
+ expect(page).to have_link('html')
+ end
+
+ expect(page).to have_link('500.html')
end
end
diff --git a/spec/frontend/repository/router_spec.js b/spec/frontend/repository/router_spec.js
index 8f3ac53c37a..6944b23558a 100644
--- a/spec/frontend/repository/router_spec.js
+++ b/spec/frontend/repository/router_spec.js
@@ -4,14 +4,15 @@ import createRouter from '~/repository/router';
describe('Repository router spec', () => {
it.each`
- path | component | componentName
- ${'/'} | ${IndexPage} | ${'IndexPage'}
- ${'/tree/master'} | ${TreePage} | ${'TreePage'}
- ${'/-/tree/master'} | ${TreePage} | ${'TreePage'}
- ${'/-/tree/master/app/assets'} | ${TreePage} | ${'TreePage'}
- ${'/-/tree/123/app/assets'} | ${null} | ${'null'}
- `('sets component as $componentName for path "$path"', ({ path, component }) => {
- const router = createRouter('', 'master');
+ path | branch | component | componentName
+ ${'/'} | ${'master'} | ${IndexPage} | ${'IndexPage'}
+ ${'/tree/master'} | ${'master'} | ${TreePage} | ${'TreePage'}
+ ${'/-/tree/master'} | ${'master'} | ${TreePage} | ${'TreePage'}
+ ${'/-/tree/master/app/assets'} | ${'master'} | ${TreePage} | ${'TreePage'}
+ ${'/-/tree/feature/test-%23/app/assets'} | ${'feature/test-#'} | ${TreePage} | ${'TreePage'}
+ ${'/-/tree/123/app/assets'} | ${'master'} | ${null} | ${'null'}
+ `('sets component as $componentName for path "$path"', ({ path, component, branch }) => {
+ const router = createRouter('', branch);
const componentsForRoute = router.getMatchedComponents(path);