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
81c24709
Commit
81c24709
authored
Jul 01, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
9685526f
8c59b4d7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
3 deletions
+45
-3
changelogs/unreleased/sh-fix-issue-63910.yml
changelogs/unreleased/sh-fix-issue-63910.yml
+5
-0
lib/banzai/filter/relative_link_filter.rb
lib/banzai/filter/relative_link_filter.rb
+3
-3
spec/helpers/markup_helper_spec.rb
spec/helpers/markup_helper_spec.rb
+37
-0
No files found.
changelogs/unreleased/sh-fix-issue-63910.yml
0 → 100644
View file @
81c24709
---
title
:
Fix attachments using the wrong URLs in e-mails
merge_request
:
30197
author
:
type
:
fixed
lib/banzai/filter/relative_link_filter.rb
View file @
81c24709
...
@@ -56,10 +56,10 @@ module Banzai
...
@@ -56,10 +56,10 @@ module Banzai
def
process_link_to_upload_attr
(
html_attr
)
def
process_link_to_upload_attr
(
html_attr
)
path_parts
=
[
Addressable
::
URI
.
unescape
(
html_attr
.
value
)]
path_parts
=
[
Addressable
::
URI
.
unescape
(
html_attr
.
value
)]
if
group
if
project
path_parts
.
unshift
(
relative_url_root
,
'groups'
,
group
.
full_path
,
'-'
)
elsif
project
path_parts
.
unshift
(
relative_url_root
,
project
.
full_path
)
path_parts
.
unshift
(
relative_url_root
,
project
.
full_path
)
elsif
group
path_parts
.
unshift
(
relative_url_root
,
'groups'
,
group
.
full_path
,
'-'
)
else
else
path_parts
.
unshift
(
relative_url_root
)
path_parts
.
unshift
(
relative_url_root
)
end
end
...
...
spec/helpers/markup_helper_spec.rb
View file @
81c24709
...
@@ -50,6 +50,43 @@ describe MarkupHelper do
...
@@ -50,6 +50,43 @@ describe MarkupHelper do
expect
(
markdown
(
actual
,
project:
second_project
)).
to
match
(
expected
)
expect
(
markdown
(
actual
,
project:
second_project
)).
to
match
(
expected
)
end
end
end
end
describe
'uploads'
do
let
(
:text
)
{
"![ImageTest](/uploads/test.png)"
}
let
(
:group
)
{
create
(
:group
)
}
subject
{
helper
.
markdown
(
text
)
}
describe
'inside a project'
do
it
'renders uploads relative to project'
do
expect
(
subject
).
to
include
(
"
#{
project
.
full_path
}
/uploads/test.png"
)
end
end
describe
'inside a group'
do
before
do
helper
.
instance_variable_set
(
:@group
,
group
)
helper
.
instance_variable_set
(
:@project
,
nil
)
end
it
'renders uploads relative to the group'
do
expect
(
subject
).
to
include
(
"
#{
group
.
full_path
}
/-/uploads/test.png"
)
end
end
describe
"with a group in the context"
do
let
(
:project_in_group
)
{
create
(
:project
,
group:
group
)
}
before
do
helper
.
instance_variable_set
(
:@group
,
group
)
helper
.
instance_variable_set
(
:@project
,
project_in_group
)
end
it
'renders uploads relative to project'
do
expect
(
subject
).
to
include
(
"
#{
project_in_group
.
path_with_namespace
}
/uploads/test.png"
)
end
end
end
end
end
describe
'#markdown_field'
do
describe
'#markdown_field'
do
...
...
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