Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
54da5cee
Commit
54da5cee
authored
Feb 21, 2022
by
Jacques
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix blob breadcrumb link
Fixed the incorrect blob breadcrumb link
parent
450f2c4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
app/assets/javascripts/repository/components/breadcrumbs.vue
app/assets/javascripts/repository/components/breadcrumbs.vue
+10
-3
spec/frontend/repository/components/breadcrumbs_spec.js
spec/frontend/repository/components/breadcrumbs_spec.js
+14
-0
No files found.
app/assets/javascripts/repository/components/breadcrumbs.vue
View file @
54da5cee
...
...
@@ -148,11 +148,16 @@ export default {
.
reduce
(
(
acc
,
name
,
i
)
=>
{
const
path
=
joinPaths
(
i
>
0
?
acc
[
i
].
path
:
''
,
escapeFileUrl
(
name
));
const
isLastPath
=
i
===
this
.
currentPath
.
split
(
'
/
'
).
length
-
1
;
const
to
=
this
.
isBlobPath
&&
isLastPath
?
`/-/blob/
${
joinPaths
(
this
.
escapedRef
,
path
)}
`
:
`/-/tree/
${
joinPaths
(
this
.
escapedRef
,
path
)}
`
;
return
acc
.
concat
({
name
,
path
,
to
:
`/-/tree/
${
joinPaths
(
this
.
escapedRef
,
path
)}
`
,
to
,
});
},
[
...
...
@@ -274,9 +279,11 @@ export default {
return
items
;
},
isBlobPath
()
{
return
this
.
$route
.
name
===
'
blobPath
'
||
this
.
$route
.
name
===
'
blobPathDecoded
'
;
},
renderAddToTreeDropdown
()
{
const
isBlobPath
=
this
.
$route
.
name
===
'
blobPath
'
||
this
.
$route
.
name
===
'
blobPathDecoded
'
;
return
!
isBlobPath
&&
(
this
.
canCollaborate
||
this
.
canCreateMrFromFork
);
return
!
this
.
isBlobPath
&&
(
this
.
canCollaborate
||
this
.
canCreateMrFromFork
);
},
},
methods
:
{
...
...
spec/frontend/repository/components/breadcrumbs_spec.js
View file @
54da5cee
...
...
@@ -59,6 +59,20 @@ describe('Repository breadcrumbs component', () => {
expect
(
wrapper
.
findAll
(
RouterLinkStub
).
length
).
toEqual
(
linkCount
);
});
it
.
each
`
routeName | path | linkTo
${
'
treePath
'
}
|
${
'
app/assets/javascripts
'
}
|
${
'
/-/tree/app/assets/javascripts
'
}
${
'
treePathDecoded
'
}
|
${
'
app/assets/javascripts
'
}
|
${
'
/-/tree/app/assets/javascripts
'
}
${
'
blobPath
'
}
|
${
'
app/assets/index.js
'
}
|
${
'
/-/blob/app/assets/index.js
'
}
${
'
blobPathDecoded
'
}
|
${
'
app/assets/index.js
'
}
|
${
'
/-/blob/app/assets/index.js
'
}
`
(
'
links to the correct router path when routeName is $routeName
'
,
({
routeName
,
path
,
linkTo
})
=>
{
factory
(
path
,
{},
{
name
:
routeName
});
expect
(
wrapper
.
findAll
(
RouterLinkStub
).
at
(
3
).
props
(
'
to
'
)).
toEqual
(
linkTo
);
},
);
it
(
'
escapes hash in directory path
'
,
()
=>
{
factory
(
'
app/assets/javascripts#
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment