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
b03b3165
Commit
b03b3165
authored
Mar 02, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing some broken merges
parent
4484587e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
5 additions
and
39 deletions
+5
-39
app/controllers/projects/jobs_controller.rb
app/controllers/projects/jobs_controller.rb
+2
-0
app/controllers/projects/lfs_storage_controller.rb
app/controllers/projects/lfs_storage_controller.rb
+1
-4
app/models/lfs_object.rb
app/models/lfs_object.rb
+0
-8
app/uploaders/attachment_uploader.rb
app/uploaders/attachment_uploader.rb
+1
-0
spec/uploaders/file_uploader_spec.rb
spec/uploaders/file_uploader_spec.rb
+0
-26
spec/workers/object_storage_upload_worker_spec.rb
spec/workers/object_storage_upload_worker_spec.rb
+1
-1
No files found.
app/controllers/projects/jobs_controller.rb
View file @
b03b3165
class
Projects::JobsController
<
Projects
::
ApplicationController
include
SendFileUpload
before_action
:build
,
except:
[
:index
,
:cancel_all
]
before_action
:authorize_read_build!
,
...
...
app/controllers/projects/lfs_storage_controller.rb
View file @
b03b3165
...
...
@@ -71,10 +71,7 @@ class Projects::LfsStorageController < Projects::GitHttpClientController
end
def
move_tmp_file_to_storage
(
object
,
path
)
File
.
open
(
path
)
do
|
f
|
object
.
file
=
f
end
object
.
file
=
File
.
open
(
path
)
object
.
file
.
store!
object
.
save
end
...
...
app/models/lfs_object.rb
View file @
b03b3165
...
...
@@ -9,16 +9,8 @@ class LfsObject < ActiveRecord::Base
validates
:oid
,
presence:
true
,
uniqueness:
true
scope
:with_files_stored_locally
,
->
{
where
(
file_store:
[
nil
,
LfsObjectUploader
::
Store
::
LOCAL
])
}
mount_uploader
:file
,
LfsObjectUploader
after_save
if: :file_changed?
,
on:
[
:create
,
:update
]
do
run_after_commit
do
file
.
schedule_background_upload
end
end
def
project_allowed_access?
(
project
)
projects
.
exists?
(
project
.
lfs_storage_project
.
id
)
end
...
...
app/uploaders/attachment_uploader.rb
View file @
b03b3165
...
...
@@ -2,6 +2,7 @@ class AttachmentUploader < GitlabUploader
include
RecordsUploads
::
Concern
include
ObjectStorage
::
Concern
prepend
ObjectStorage
::
Extension
::
RecordsUploads
include
UploaderHelper
private
...
...
spec/uploaders/file_uploader_spec.rb
View file @
b03b3165
...
...
@@ -89,29 +89,6 @@ describe FileUploader do
end
end
describe
'callbacks'
do
describe
'#prune_store_dir after :remove'
do
before
do
uploader
.
store!
(
fixture_file_upload
(
'spec/fixtures/doc_sample.txt'
))
end
def
store_dir
File
.
expand_path
(
uploader
.
store_dir
,
uploader
.
root
)
end
it
'is called'
do
expect
(
uploader
).
to
receive
(
:prune_store_dir
).
once
uploader
.
remove!
end
it
'prune the store directory'
do
expect
{
uploader
.
remove!
}
.
to
change
{
File
.
exist?
(
store_dir
)
}.
from
(
true
).
to
(
false
)
end
end
end
describe
"#migrate!"
do
before
do
uploader
.
store!
(
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
)))
...
...
@@ -137,8 +114,5 @@ describe FileUploader do
uploader
.
upload
=
upload
end
it_behaves_like
"migrates"
,
to_store:
described_class
::
Store
::
REMOTE
it_behaves_like
"migrates"
,
from_store:
described_class
::
Store
::
REMOTE
,
to_store:
described_class
::
Store
::
LOCAL
end
end
spec/workers/object_storage_upload_worker_spec.rb
View file @
b03b3165
...
...
@@ -20,7 +20,7 @@ describe ObjectStorageUploadWorker do
stub_lfs_object_storage
(
background_upload:
true
)
end
it
'uploads object to storage'
d
it
'uploads object to storage'
d
o
expect
{
perform
}.
to
change
{
lfs_object
.
reload
.
file_store
}.
from
(
local
).
to
(
remote
)
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