Commit 3b7d9445 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch '240931-broken-redirection' into 'master'

Fixed snippet URLs for sub-folders

See merge request gitlab-org/gitlab!40316
parents a805355a a2843c82
...@@ -90,7 +90,7 @@ export default { ...@@ -90,7 +90,7 @@ export default {
if (this.newSnippet) { if (this.newSnippet) {
return this.projectPath return this.projectPath
? `${gon.relative_url_root}${this.projectPath}/-/snippets` ? `${gon.relative_url_root}${this.projectPath}/-/snippets`
: `${gon.relative_url_root}-/snippets`; : `${gon.relative_url_root}/-/snippets`;
} }
return this.snippet.webUrl; return this.snippet.webUrl;
}, },
......
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
text: __('New snippet'), text: __('New snippet'),
href: this.snippet.project href: this.snippet.project
? `${this.snippet.project.webUrl}/-/snippets/new` ? `${this.snippet.project.webUrl}/-/snippets/new`
: `${gon.relative_url_root}-/snippets/new`, : `${gon.relative_url_root}/-/snippets/new`,
variant: 'success', variant: 'success',
category: 'secondary', category: 'secondary',
cssClass: 'ml-2', cssClass: 'ml-2',
......
...@@ -200,7 +200,7 @@ describe('Snippet Edit app', () => { ...@@ -200,7 +200,7 @@ describe('Snippet Edit app', () => {
it.each` it.each`
projectPath | snippetArg | expectation projectPath | snippetArg | expectation
${''} | ${[]} | ${`${relativeUrlRoot}-/snippets`} ${''} | ${[]} | ${`${relativeUrlRoot}/-/snippets`}
${'project/path'} | ${[]} | ${`${relativeUrlRoot}project/path/-/snippets`} ${'project/path'} | ${[]} | ${`${relativeUrlRoot}project/path/-/snippets`}
${''} | ${[createTestSnippet()]} | ${TEST_WEB_URL} ${''} | ${[createTestSnippet()]} | ${TEST_WEB_URL}
${'project/path'} | ${[createTestSnippet()]} | ${TEST_WEB_URL} ${'project/path'} | ${[createTestSnippet()]} | ${TEST_WEB_URL}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment