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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
3d0fc7fe
Commit
3d0fc7fe
authored
Apr 30, 2019
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure Issue & MR note_html cannot be imported
parent
1cbdc532
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
spec/lib/gitlab/import_export/project.json
spec/lib/gitlab/import_export/project.json
+4
-2
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+12
-14
No files found.
spec/lib/gitlab/import_export/project.json
View file @
3d0fc7fe
...
...
@@ -158,8 +158,8 @@
{
"id"
:
351
,
"note"
:
"Quo reprehenderit aliquam qui dicta impedit cupiditate eligendi."
,
"note_html"
:
"<p>
dodgy html
</p>"
,
"cached_markdown_version"
:
434343
,
"note_html"
:
"<p>
something else entirely
</p>"
,
"cached_markdown_version"
:
917504
,
"noteable_type"
:
"Issue"
,
"author_id"
:
26
,
"created_at"
:
"2016-06-14T15:02:47.770Z"
,
...
...
@@ -2367,6 +2367,8 @@
{
"id"
:
671
,
"note"
:
"Sit voluptatibus eveniet architecto quidem."
,
"note_html"
:
"<p>something else entirely</p>"
,
"cached_markdown_version"
:
917504
,
"noteable_type"
:
"MergeRequest"
,
"author_id"
:
26
,
"created_at"
:
"2016-06-14T15:02:56.632Z"
,
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
3d0fc7fe
...
...
@@ -10,7 +10,6 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
create
(
:user
,
username:
'bernard_willms'
),
create
(
:user
,
username:
'saul_will'
)
]
@markdown_classes
=
[
AbuseReport
,
Appearance
,
ApplicationSetting
,
BroadcastMessage
,
Issue
,
Label
,
MergeRequest
,
Milestone
,
Namespace
,
Project
,
Release
,
ResourceLabelEvent
,
Snippet
,
UserStatus
]
RSpec
::
Mocks
.
with_temporary_scope
do
@project
=
create
(
:project
,
:builds_enabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
...
...
@@ -22,7 +21,6 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:create_branch
).
with
(
'feature'
,
'DCBA'
)
allow_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:create_branch
)
@markdown_classes
.
each
{
|
klass
|
allow_any_instance_of
(
klass
).
to
receive
(
:latest_cached_markdown_version
).
and_return
(
434343
)}
@project_tree_restorer
=
described_class
.
new
(
user:
@user
,
shared:
@shared
,
project:
@project
)
...
...
@@ -61,20 +59,20 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end
context
'when importing a project with cached_markdown_version and note_html'
do
let!
(
:issue
)
{
Issue
.
find_by
(
description:
'Aliquam enim illo et possimus.'
)
}
let
(
:note1
)
{
issue
.
notes
.
select
{
|
n
|
n
.
note
.
match
(
/Quo reprehenderit aliquam qui dicta impedit cupiditate eligendi/
)}.
first
}
let
(
:note2
)
{
issue
.
notes
.
select
{
|
n
|
n
.
note
.
match
(
/Est reprehenderit quas aut aspernatur autem recusandae voluptatem/
)}.
first
}
it
'does not import the note_html'
do
expect
(
note1
.
note_html
).
to
match
(
/Quo reprehenderit aliquam qui dicta impedit cupiditate eligendi/
)
context
'for an Issue'
do
it
'does not import note_html'
do
note_content
=
'Quo reprehenderit aliquam qui dicta impedit cupiditate eligendi'
issue_note
=
Issue
.
find_by
(
description:
'Aliquam enim illo et possimus.'
).
notes
.
select
{
|
n
|
n
.
note
.
match
(
/
#{
note_content
}
/
)}.
first
expect
(
issue_note
.
note_html
).
to
match
(
/
#{
note_content
}
/
)
end
it
'does not set the old cached_markdown_version'
do
expect
(
note2
.
cached_markdown_version
).
not_to
eq
(
121212
)
end
it
'does not import the note_html'
do
expect
(
note2
.
note_html
).
to
match
(
/Est reprehenderit quas aut aspernatur autem recusandae voluptatem/
)
context
'for a Merge Request'
do
it
'does not import note_html'
do
note_content
=
'Sit voluptatibus eveniet architecto quidem'
merge_request_note
=
MergeRequest
.
find_by
(
title:
'MR1'
).
notes
.
select
{
|
n
|
n
.
note
.
match
(
/
#{
note_content
}
/
)}.
first
expect
(
merge_request_note
.
note_html
).
to
match
(
/
#{
note_content
}
/
)
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