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
3ebd5793
Commit
3ebd5793
authored
Feb 11, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Apollo throwing error with specific path names
Also fixes the display of folders with special characters
parent
ec46fc91
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
2 deletions
+66
-2
app/assets/javascripts/repository/components/table/row.vue
app/assets/javascripts/repository/components/table/row.vue
+2
-1
app/assets/javascripts/repository/graphql.js
app/assets/javascripts/repository/graphql.js
+1
-1
spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
...epository/components/table/__snapshots__/row_spec.js.snap
+49
-0
spec/frontend/repository/components/table/row_spec.js
spec/frontend/repository/components/table/row_spec.js
+14
-0
No files found.
app/assets/javascripts/repository/components/table/row.vue
View file @
3ebd5793
<
script
>
import
{
escapeRegExp
}
from
'
lodash
'
;
import
{
GlBadge
,
GlLink
,
GlSkeletonLoading
,
GlTooltipDirective
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
import
TimeagoTooltip
from
'
~/vue_shared/components/time_ago_tooltip.vue
'
;
...
...
@@ -105,7 +106,7 @@ export default {
return
this
.
isFolder
?
'
router-link
'
:
'
a
'
;
},
fullPath
()
{
return
this
.
path
.
replace
(
new
RegExp
(
`^
${
this
.
currentPath
}
/`
),
''
);
return
this
.
path
.
replace
(
new
RegExp
(
`^
${
escapeRegExp
(
this
.
currentPath
)
}
/`
),
''
);
},
shortSha
()
{
return
this
.
sha
.
slice
(
0
,
8
);
...
...
app/assets/javascripts/repository/graphql.js
View file @
3ebd5793
...
...
@@ -48,7 +48,7 @@ const defaultClient = createDefaultClient(
case
'
TreeEntry
'
:
case
'
Submodule
'
:
case
'
Blob
'
:
return
`
${
obj
.
flatPath
}
-
${
obj
.
id
}
`
;
return
`
${
escape
(
obj
.
flatPath
)
}
-
${
obj
.
id
}
`
;
default
:
// If the type doesn't match any of the above we fallback
// to using the default Apollo ID
...
...
spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
View file @
3ebd5793
...
...
@@ -48,3 +48,52 @@ exports[`Repository table row component renders table row 1`] = `
</td>
</tr>
`;
exports[`Repository table row component renders table row for path with special character 1`] = `
<tr
class="tree-item file_1"
>
<td
class="tree-item-file-name"
>
<i
aria-label="file"
class="fa fa-fw fa-file-text-o"
role="img"
/>
<a
class="str-truncated"
href="https://test.com"
>
test
</a>
<!---->
<!---->
<!---->
</td>
<td
class="d-none d-sm-table-cell tree-commit"
>
<gl-skeleton-loading-stub
class="h-auto"
lines="1"
/>
</td>
<td
class="tree-time-ago text-right"
>
<gl-skeleton-loading-stub
class="ml-auto h-auto w-50"
lines="1"
/>
</td>
</tr>
`;
spec/frontend/repository/components/table/row_spec.js
View file @
3ebd5793
...
...
@@ -51,6 +51,20 @@ describe('Repository table row component', () => {
});
});
it
(
'
renders table row for path with special character
'
,
()
=>
{
factory
({
id
:
'
1
'
,
sha
:
'
123
'
,
path
:
'
test$/test
'
,
type
:
'
file
'
,
currentPath
:
'
test$
'
,
});
return
vm
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
vm
.
element
).
toMatchSnapshot
();
});
});
it
.
each
`
type | component | componentName
${
'
tree
'
}
|
${
RouterLinkStub
}
|
${
'
RouterLink
'
}
...
...
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