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
402c0312
Commit
402c0312
authored
Mar 17, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix remove special chars from snippet url_to_repo
parent
a799004a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
app/models/snippet.rb
app/models/snippet.rb
+4
-0
changelogs/unreleased/fj-fix-snippet-url-to-repo.yml
changelogs/unreleased/fj-fix-snippet-url-to-repo.yml
+5
-0
spec/models/snippet_spec.rb
spec/models/snippet_spec.rb
+16
-0
No files found.
app/models/snippet.rb
View file @
402c0312
...
...
@@ -283,6 +283,10 @@ class Snippet < ApplicationRecord
end
end
def
url_to_repo
Gitlab
::
Shell
.
url_to_repo
(
full_path
.
delete
(
'@'
))
end
def
repository_storage
snippet_repository
&
.
shard_name
||
Gitlab
::
CurrentSettings
.
pick_repository_storage
...
...
changelogs/unreleased/fj-fix-snippet-url-to-repo.yml
0 → 100644
View file @
402c0312
---
title
:
Fix remove special chars from snippet url_to_repo
merge_request
:
27390
author
:
type
:
fixed
spec/models/snippet_spec.rb
View file @
402c0312
...
...
@@ -697,4 +697,20 @@ describe Snippet do
it
{
is_expected
.
to
eq
result
}
end
end
describe
'#url_to_repo'
do
subject
{
snippet
.
url_to_repo
}
context
'with personal snippet'
do
let
(
:snippet
)
{
create
(
:personal_snippet
)
}
it
{
is_expected
.
to
eq
(
Gitlab
.
config
.
gitlab_shell
.
ssh_path_prefix
+
"snippets/
#{
snippet
.
id
}
.git"
)
}
end
context
'with project snippet'
do
let
(
:snippet
)
{
create
(
:project_snippet
)
}
it
{
is_expected
.
to
eq
(
Gitlab
.
config
.
gitlab_shell
.
ssh_path_prefix
+
"
#{
snippet
.
project
.
full_path
}
/snippets/
#{
snippet
.
id
}
.git"
)
}
end
end
end
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