Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Gitlab-External-Templates
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adri
Gitlab-External-Templates
Commits
bf58717c
Commit
bf58717c
authored
7 years ago
by
Kamil Trzciński
Browse files
Options
Downloads
Patches
Plain Diff
Fix direct upload for LFS
parent
fc914225
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/projects/lfs_storage_controller.rb
+4
-5
4 additions, 5 deletions
app/controllers/projects/lfs_storage_controller.rb
ee/app/uploaders/object_storage.rb
+9
-11
9 additions, 11 deletions
ee/app/uploaders/object_storage.rb
with
13 additions
and
16 deletions
app/controllers/projects/lfs_storage_controller.rb
+
4
−
5
View file @
bf58717c
...
...
@@ -51,12 +51,11 @@ def size
end
def
store_file
(
oid
,
size
)
object
=
LfsObject
.
find_
or_create_
by
(
oid:
oid
,
size:
size
)
file_exists
=
object
.
file
.
exists?
object
=
LfsObject
.
find_by
(
oid:
oid
,
size:
size
)
file_exists
=
object
&
.
file
&
.
exists?
unless
file_exists
object
.
file
.
retrive_uploaded_file!
(
params
[
"file.object_id"
],
params
[
"file.name"
])
object
.
file
.
store!
object
.
save!
object
=
LfsObject
.
new
(
oid:
oid
,
size:
size
)
object
.
file
.
store_remote_file!
(
params
[
"file.object_id"
],
params
[
"file.name"
])
file_exists
=
true
end
...
...
This diff is collapsed.
Click to expand it.
ee/app/uploaders/object_storage.rb
+
9
−
11
View file @
bf58717c
...
...
@@ -131,7 +131,8 @@ def remote_store_path
end
def
licensed?
License
.
feature_available?
(
:object_storage
)
# TODO to bring back
true
||
License
.
feature_available?
(
:object_storage
)
end
def
serialization_column
(
model_class
,
mount_point
)
...
...
@@ -176,7 +177,7 @@ def persist_object_store?
def
persist_object_store!
return
unless
persist_object_store?
updated
=
model
.
update
_column
(
store_serialization_column
,
object_store
)
updated
=
model
.
update
({
store_serialization_column
=>
object_store
}
)
raise
ActiveRecordError
unless
updated
end
...
...
@@ -288,9 +289,11 @@ def upload_authorize
# result['TempPath'] = cache_path
remote_path
=
cache_path
remote_path
.
slice!
(
self
.
class
.
local_store_path
)
remote_path
.
slice!
(
self
.
root
)
remote_path
.
slice!
(
'/'
)
remote_storage
=
storage_for
(
Store
::
REMOTE
)
expire_at
=
::
Fog
::
Time
.
now
+
24
.
hours
result
[
:ObjectStore
]
=
{
ObjectID
:
cache_name
,
...
...
@@ -319,7 +322,7 @@ def retrive_uploaded_file!(identifier, filename)
@use_storage_for_cache
=
true
puts
"xxy1"
self
.
object_store
=
REMOTE_STOR
E
self
.
object_store
=
Store
::
REMOT
E
puts
"xxy2"
retrieve_from_cache!
(
identifier
)
...
...
@@ -329,14 +332,9 @@ def retrive_uploaded_file!(identifier, filename)
end
def
store_remote_file!
(
identifier
,
filename
)
@use_storage_for_cache
=
true
self
.
object_store
=
REMOTE_STORE
retrieve_from_cache!
(
identifier
)
@filename
=
filename
retrive_uploaded_file!
(
identifier
,
filename
)
store!
ensure
@use_storage_for_cache
=
false
persist_object_store!
end
def
cache_storage
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment