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
7fd26434
Commit
7fd26434
authored
Nov 15, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rubocop offenses
parent
dd8680a7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
11 deletions
+9
-11
lib/gitlab/background_migration/prepare_untracked_uploads.rb
lib/gitlab/background_migration/prepare_untracked_uploads.rb
+5
-5
spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb
...b/background_migration/populate_untracked_uploads_spec.rb
+2
-4
spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb
...ab/background_migration/prepare_untracked_uploads_spec.rb
+1
-1
spec/migrations/track_untracked_uploads_spec.rb
spec/migrations/track_untracked_uploads_spec.rb
+1
-1
No files found.
lib/gitlab/background_migration/prepare_untracked_uploads.rb
View file @
7fd26434
...
@@ -97,7 +97,7 @@ module Gitlab
...
@@ -97,7 +97,7 @@ module Gitlab
end
end
timestamp
=
Time
.
now
.
utc
.
iso8601
timestamp
=
Time
.
now
.
utc
.
iso8601
sql
=
ActiveRecord
::
Base
.
send
(
:sanitize_sql_array
,
[
sql
,
file_path
,
timestamp
,
timestamp
])
sql
=
ActiveRecord
::
Base
.
send
(
:sanitize_sql_array
,
[
sql
,
file_path
,
timestamp
,
timestamp
])
# rubocop:disable GitlabSecurity/PublicSend
ActiveRecord
::
Base
.
connection
.
execute
(
sql
)
ActiveRecord
::
Base
.
connection
.
execute
(
sql
)
end
end
...
...
spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb
View file @
7fd26434
...
@@ -215,7 +215,6 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do
...
@@ -215,7 +215,6 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do
context
'for a project Markdown attachment (notes, issues, MR descriptions) file path'
do
context
'for a project Markdown attachment (notes, issues, MR descriptions) file path'
do
let
(
:model
)
{
create
(
:project
)
}
let
(
:model
)
{
create
(
:project
)
}
let
(
:expected_upload_attrs
)
{
{}
}
# UntrackedFile.path is different than Upload.path
# UntrackedFile.path is different than Upload.path
let
(
:untracked_file
)
{
create_untracked_file
(
"/
#{
model
.
full_path
}
/
#{
model
.
uploads
.
first
.
path
}
"
)
}
let
(
:untracked_file
)
{
create_untracked_file
(
"/
#{
model
.
full_path
}
/
#{
model
.
uploads
.
first
.
path
}
"
)
}
...
@@ -228,7 +227,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do
...
@@ -228,7 +227,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do
untracked_file
untracked_file
# Save the expected upload attributes
# Save the expected upload attributes
expected_upload_attrs
=
model
.
reload
.
uploads
.
first
.
attributes
.
slice
(
'path'
,
'uploader'
,
'size'
,
'checksum'
)
@
expected_upload_attrs
=
model
.
reload
.
uploads
.
first
.
attributes
.
slice
(
'path'
,
'uploader'
,
'size'
,
'checksum'
)
# Untrack the file
# Untrack the file
model
.
reload
.
uploads
.
delete_all
model
.
reload
.
uploads
.
delete_all
...
@@ -239,8 +238,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do
...
@@ -239,8 +238,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UntrackedFile do
untracked_file
.
add_to_uploads
untracked_file
.
add_to_uploads
end
.
to
change
{
model
.
reload
.
uploads
.
count
}.
from
(
0
).
to
(
1
)
end
.
to
change
{
model
.
reload
.
uploads
.
count
}.
from
(
0
).
to
(
1
)
hex_secret
=
untracked_file
.
path
.
match
(
/\/(\h+)\/rails_sample.jpg/
)[
1
]
expect
(
model
.
uploads
.
first
.
attributes
).
to
include
(
@expected_upload_attrs
)
expect
(
model
.
uploads
.
first
.
attributes
).
to
include
(
expected_upload_attrs
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb
View file @
7fd26434
spec/migrations/track_untracked_uploads_spec.rb
View file @
7fd26434
...
@@ -42,7 +42,7 @@ describe TrackUntrackedUploads, :migration, :sidekiq, :temp_table_may_drop do
...
@@ -42,7 +42,7 @@ describe TrackUntrackedUploads, :migration, :sidekiq, :temp_table_may_drop do
it
'has a path field long enough for really long paths'
do
it
'has a path field long enough for really long paths'
do
migrate!
migrate!
component
=
'a'
*
255
component
=
'a'
*
255
long_path
=
[
long_path
=
[
'uploads'
,
'uploads'
,
...
...
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