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
a23ef89e
Commit
a23ef89e
authored
May 29, 2018
by
Alessio Caiazza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix missing timeout value in object storage pre-authorization call
parent
4c74936f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
app/uploaders/object_storage.rb
app/uploaders/object_storage.rb
+3
-1
changelogs/unreleased/fix-missing-timeout.yml
changelogs/unreleased/fix-missing-timeout.yml
+5
-0
spec/uploaders/object_storage_spec.rb
spec/uploaders/object_storage_spec.rb
+2
-0
No files found.
app/uploaders/object_storage.rb
View file @
a23ef89e
...
...
@@ -11,6 +11,7 @@ module ObjectStorage
ObjectStorageUnavailable
=
Class
.
new
(
StandardError
)
DIRECT_UPLOAD_TIMEOUT
=
4
.
hours
DIRECT_UPLOAD_EXPIRE_OFFSET
=
15
.
minutes
TMP_UPLOAD_PATH
=
'tmp/uploads'
.
freeze
module
Store
...
...
@@ -174,11 +175,12 @@ module ObjectStorage
id
=
[
CarrierWave
.
generate_cache_id
,
SecureRandom
.
hex
].
join
(
'-'
)
upload_path
=
File
.
join
(
TMP_UPLOAD_PATH
,
id
)
connection
=
::
Fog
::
Storage
.
new
(
self
.
object_store_credentials
)
expire_at
=
Time
.
now
+
DIRECT_UPLOAD_TIMEOUT
expire_at
=
Time
.
now
+
DIRECT_UPLOAD_TIMEOUT
+
DIRECT_UPLOAD_EXPIRE_OFFSET
options
=
{
'Content-Type'
=>
'application/octet-stream'
}
{
ID
:
id
,
Timeout
:
DIRECT_UPLOAD_TIMEOUT
,
GetURL
:
connection
.
get_object_url
(
remote_store_path
,
upload_path
,
expire_at
),
DeleteURL
:
connection
.
delete_object_url
(
remote_store_path
,
upload_path
,
expire_at
),
StoreURL
:
connection
.
put_object_url
(
remote_store_path
,
upload_path
,
expire_at
,
options
)
...
...
changelogs/unreleased/fix-missing-timeout.yml
0 → 100644
View file @
a23ef89e
---
title
:
Missing timeout value in object storage pre-authorization
merge_request
:
19201
author
:
type
:
fixed
spec/uploaders/object_storage_spec.rb
View file @
a23ef89e
...
...
@@ -382,6 +382,8 @@ describe ObjectStorage do
is_expected
.
to
have_key
(
:RemoteObject
)
expect
(
subject
[
:RemoteObject
]).
to
have_key
(
:ID
)
expect
(
subject
[
:RemoteObject
]).
to
include
(
Timeout
:
a_kind_of
(
Integer
))
expect
(
subject
[
:RemoteObject
][
:Timeout
]).
to
be
(
ObjectStorage
::
DIRECT_UPLOAD_TIMEOUT
)
expect
(
subject
[
:RemoteObject
]).
to
have_key
(
:GetURL
)
expect
(
subject
[
:RemoteObject
]).
to
have_key
(
:DeleteURL
)
expect
(
subject
[
:RemoteObject
]).
to
have_key
(
:StoreURL
)
...
...
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