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
ffb2400a
Commit
ffb2400a
authored
Oct 22, 2020
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract uploaded_file into method in LfsStorageController
parent
ff0bbef0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
app/controllers/repositories/lfs_storage_controller.rb
app/controllers/repositories/lfs_storage_controller.rb
+4
-3
No files found.
app/controllers/repositories/lfs_storage_controller.rb
View file @
ffb2400a
...
...
@@ -59,6 +59,10 @@ module Repositories
params
[
:size
].
to_i
end
def
uploaded_file
params
[
:file
]
end
# rubocop: disable CodeReuse/ActiveRecord
def
store_file!
(
oid
,
size
)
object
=
LfsObject
.
find_by
(
oid:
oid
,
size:
size
)
...
...
@@ -76,15 +80,12 @@ module Repositories
# rubocop: enable CodeReuse/ActiveRecord
def
create_file!
(
oid
,
size
)
uploaded_file
=
params
[
:file
]
return
unless
uploaded_file
.
is_a?
(
UploadedFile
)
LfsObject
.
create!
(
oid:
oid
,
size:
size
,
file:
uploaded_file
)
end
def
replace_file!
(
lfs_object
)
uploaded_file
=
params
[
:file
]
raise
UploadedFile
::
InvalidPathError
unless
uploaded_file
.
is_a?
(
UploadedFile
)
Gitlab
::
AppJsonLogger
.
info
(
message:
"LFS file replaced because it did not exist"
,
oid:
oid
,
size:
size
)
...
...
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