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
6be9ede5
Commit
6be9ede5
authored
Aug 25, 2020
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use joinPaths to build URL
parent
cf8b5288
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
app/assets/javascripts/snippets/components/edit.vue
app/assets/javascripts/snippets/components/edit.vue
+2
-4
app/assets/javascripts/snippets/components/snippet_header.vue
...assets/javascripts/snippets/components/snippet_header.vue
+3
-2
spec/frontend/snippets/components/edit_spec.js
spec/frontend/snippets/components/edit_spec.js
+2
-2
No files found.
app/assets/javascripts/snippets/components/edit.vue
View file @
6be9ede5
...
...
@@ -4,7 +4,7 @@ import { GlButton, GlLoadingIcon } from '@gitlab/ui';
import
{
deprecatedCreateFlash
as
Flash
}
from
'
~/flash
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
TitleField
from
'
~/vue_shared/components/form/title.vue
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
{
redirectTo
,
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
import
FormFooterActions
from
'
~/vue_shared/components/form/form_footer_actions.vue
'
;
import
UpdateSnippetMutation
from
'
../mutations/updateSnippet.mutation.graphql
'
;
...
...
@@ -88,9 +88,7 @@ export default {
},
cancelButtonHref
()
{
if
(
this
.
newSnippet
)
{
return
this
.
projectPath
?
`
${
gon
.
relative_url_root
}${
this
.
projectPath
}
/-/snippets`
:
`
${
gon
.
relative_url_root
}
/-/snippets`
;
return
joinPaths
(
'
/
'
,
gon
.
relative_url_root
,
this
.
projectPath
,
'
-/snippets
'
);
}
return
this
.
snippet
.
webUrl
;
},
...
...
app/assets/javascripts/snippets/components/snippet_header.vue
View file @
6be9ede5
...
...
@@ -17,6 +17,7 @@ import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import
DeleteSnippetMutation
from
'
../mutations/deleteSnippet.mutation.graphql
'
;
import
CanCreatePersonalSnippet
from
'
../queries/userPermissions.query.graphql
'
;
import
CanCreateProjectSnippet
from
'
../queries/projectPermissions.query.graphql
'
;
import
{
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
export
default
{
components
:
{
...
...
@@ -96,8 +97,8 @@ export default {
condition
:
this
.
canCreateSnippet
,
text
:
__
(
'
New snippet
'
),
href
:
this
.
snippet
.
project
?
`
${
this
.
snippet
.
project
.
webUrl
}
/-/snippets/new`
:
`
${
gon
.
relative_url_root
}
/-/snippets/new`
,
?
joinPaths
(
this
.
snippet
.
project
.
webUrl
,
'
-/snippets/new
'
)
:
joinPaths
(
'
/
'
,
gon
.
relative_url_root
,
'
/-/snippets/new
'
)
,
variant
:
'
success
'
,
category
:
'
secondary
'
,
cssClass
:
'
ml-2
'
,
...
...
spec/frontend/snippets/components/edit_spec.js
View file @
6be9ede5
...
...
@@ -200,8 +200,8 @@ describe('Snippet Edit app', () => {
it
.
each
`
projectPath | snippetArg | expectation
${
''
}
|
${[]}
|
${
`
${
relativeUrlRoot
}
/-/snippets`
}
${
'
project/path
'
}
|
${[]}
|
${
`
${
relativeUrlRoot
}
project/path/-/snippets`
}
${
''
}
|
${[]}
|
${
urlUtils
.
joinPaths
(
'
/
'
,
relativeUrlRoot
,
'
-
'
,
'
snippets
'
)
}
${
'
project/path
'
}
|
${[]}
|
${
urlUtils
.
joinPaths
(
'
/
'
,
relativeUrlRoot
,
'
project/path/-
'
,
'
snippets
'
)
}
${
''
}
|
${[
createTestSnippet
()]}
|
${
TEST_WEB_URL
}
${
'
project/path
'
}
|
${[
createTestSnippet
()]}
|
${
TEST_WEB_URL
}
`
(
...
...
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