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
Léo-Paul Géneau
gitlab-ce
Commits
ffbaf19f
Commit
ffbaf19f
authored
Nov 07, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rubocop offenses
parent
13e0ee37
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
lib/gitlab/background_migration/populate_untracked_uploads.rb
...gitlab/background_migration/populate_untracked_uploads.rb
+8
-8
lib/gitlab/background_migration/prepare_unhashed_uploads.rb
lib/gitlab/background_migration/prepare_unhashed_uploads.rb
+3
-3
spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb
...b/background_migration/populate_untracked_uploads_spec.rb
+1
-1
spec/migrations/track_untracked_uploads_spec.rb
spec/migrations/track_untracked_uploads_spec.rb
+2
-2
No files found.
lib/gitlab/background_migration/populate_untracked_uploads.rb
View file @
ffbaf19f
...
...
@@ -15,39 +15,39 @@ module Gitlab
{
pattern:
/\A-\/system\/appearance\/logo\/(\d+)/
,
uploader:
'AttachmentUploader'
,
model_type:
'Appearance'
,
model_type:
'Appearance'
},
{
pattern:
/\A-\/system\/appearance\/header_logo\/(\d+)/
,
uploader:
'AttachmentUploader'
,
model_type:
'Appearance'
,
model_type:
'Appearance'
},
{
pattern:
/\A-\/system\/note\/attachment\/(\d+)/
,
uploader:
'AttachmentUploader'
,
model_type:
'Note'
,
model_type:
'Note'
},
{
pattern:
/\A-\/system\/user\/avatar\/(\d+)/
,
uploader:
'AvatarUploader'
,
model_type:
'User'
,
model_type:
'User'
},
{
pattern:
/\A-\/system\/group\/avatar\/(\d+)/
,
uploader:
'AvatarUploader'
,
model_type:
'Namespace'
,
model_type:
'Namespace'
},
{
pattern:
/\A-\/system\/project\/avatar\/(\d+)/
,
uploader:
'AvatarUploader'
,
model_type:
'Project'
,
model_type:
'Project'
},
{
pattern:
FILE_UPLOADER_PATH_PATTERN
,
uploader:
'FileUploader'
,
model_type:
'Project'
}
,
]
}
]
.
freeze
scope
:untracked
,
->
{
where
(
tracked:
false
)
}
...
...
lib/gitlab/background_migration/prepare_unhashed_uploads.rb
View file @
ffbaf19f
...
...
@@ -5,8 +5,8 @@ module Gitlab
include
Database
::
MigrationHelpers
FILE_PATH_BATCH_SIZE
=
500
UPLOAD_DIR
=
"
#{
CarrierWave
.
root
}
/uploads"
FOLLOW_UP_MIGRATION
=
'PopulateUntrackedUploads'
UPLOAD_DIR
=
"
#{
CarrierWave
.
root
}
/uploads"
.
freeze
FOLLOW_UP_MIGRATION
=
'PopulateUntrackedUploads'
.
freeze
class
UnhashedUploadFile
<
ActiveRecord
::
Base
include
EachBatch
...
...
@@ -33,7 +33,7 @@ module Gitlab
end
def
store_unhashed_upload_file_paths
return
unless
Dir
.
exist
s
?
(
UPLOAD_DIR
)
return
unless
Dir
.
exist?
(
UPLOAD_DIR
)
file_paths
=
[]
each_file_path
(
UPLOAD_DIR
)
do
|
file_path
|
...
...
spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb
View file @
ffbaf19f
...
...
@@ -129,7 +129,7 @@ describe Gitlab::BackgroundMigration::PopulateUntrackedUploads::UnhashedUploadFi
it
'does not add an upload'
do
expect
do
unhashed_upload_file
.
ensure_tracked!
end
.
to_not
change
{
upload_class
.
count
}.
from
(
1
)
end
.
not_to
change
{
upload_class
.
count
}.
from
(
1
)
end
end
end
...
...
spec/migrations/track_untracked_uploads_spec.rb
View file @
ffbaf19f
...
...
@@ -37,7 +37,7 @@ describe TrackUntrackedUploads, :migration, :sidekiq do
migrate!
max_length_namespace_path
=
max_length_project_path
=
max_length_filename
=
'a'
*
255
long_path
=
"./uploads
#{
(
"/
#{
max_length_namespace_path
}
"
)
*
Namespace
::
NUMBER_OF_ANCESTORS_ALLOWED
}
/
#{
max_length_project_path
}
/
#{
max_length_filename
}
"
long_path
=
"./uploads
#{
"/
#{
max_length_namespace_path
}
"
*
Namespace
::
NUMBER_OF_ANCESTORS_ALLOWED
}
/
#{
max_length_project_path
}
/
#{
max_length_filename
}
"
unhashed_upload_file
=
UnhashedUploadFile
.
new
(
path:
long_path
)
unhashed_upload_file
.
save!
expect
(
UnhashedUploadFile
.
first
.
path
.
size
).
to
eq
(
5641
)
...
...
@@ -106,7 +106,7 @@ describe TrackUntrackedUploads, :migration, :sidekiq do
expect
(
user1
.
reload
.
uploads
.
first
.
attributes
).
to
include
({
"path"
=>
"uploads/-/system/user/avatar/
#{
user1
.
id
}
/rails_sample.jpg"
,
"uploader"
=>
"AvatarUploader"
,
"uploader"
=>
"AvatarUploader"
}.
merge
(
rails_sample_jpg_attrs
))
expect
(
project1
.
reload
.
uploads
.
first
.
attributes
).
to
include
({
"path"
=>
"uploads/-/system/project/avatar/
#{
project1
.
id
}
/rails_sample.jpg"
,
...
...
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