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
609fc37b
Commit
609fc37b
authored
Jan 30, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvements after the ce-mr
parent
00608acc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
28 deletions
+10
-28
app/uploaders/gitlab_uploader.rb
app/uploaders/gitlab_uploader.rb
+6
-5
ee/app/uploaders/object_storage.rb
ee/app/uploaders/object_storage.rb
+0
-22
spec/uploaders/records_uploads_spec.rb
spec/uploaders/records_uploads_spec.rb
+4
-1
No files found.
app/uploaders/gitlab_uploader.rb
View file @
609fc37b
...
...
@@ -47,11 +47,12 @@ class GitlabUploader < CarrierWave::Uploader::Base
file
.
present?
end
# Override this if you don't want to save files by default to the Rails.root directory
def
cache_dir
File
.
join
(
root
,
base_dir
,
'tmp/cache'
)
end
def
work_dir
# Default path set by CarrierWave:
# https://github.com/carrierwaveuploader/carrierwave/blob/v1.0.0/lib/carrierwave/uploader/cache.rb#L182
CarrierWave
.
tmp_path
File
.
join
(
root
,
base_dir
,
'tmp/work'
)
end
def
filename
...
...
@@ -78,6 +79,6 @@ class GitlabUploader < CarrierWave::Uploader::Base
# To be safe, keep this directory outside of the the cache directory
# because calling CarrierWave.clean_cache_files! will remove any files in
# the cache directory.
File
.
join
(
work_dir
,
@
cache_id
,
version_name
.
to_s
,
for_file
)
File
.
join
(
work_dir
,
cache_id
,
version_name
.
to_s
,
for_file
)
end
end
ee/app/uploaders/object_storage.rb
View file @
609fc37b
...
...
@@ -224,18 +224,6 @@ module ObjectStorage
file
.
present?
end
def
cache_dir
File
.
join
(
root
,
base_dir
,
'tmp/cache'
)
end
# Override this if you don't want to save local files by default to the Rails.root directory
def
work_dir
# Default path set by CarrierWave:
# https://github.com/carrierwaveuploader/carrierwave/blob/v1.1.0/lib/carrierwave/uploader/cache.rb#L182
# CarrierWave.tmp_path
File
.
join
(
root
,
base_dir
,
'tmp/work'
)
end
def
store_dir
(
store
=
nil
)
store_dirs
[
store
||
object_store
]
end
...
...
@@ -281,15 +269,5 @@ module ObjectStorage
raise
UnknownStoreError
end
end
# To prevent files in local storage from moving across filesystems, override
# the default implementation:
# http://github.com/carrierwaveuploader/carrierwave/blob/v1.1.0/lib/carrierwave/uploader/cache.rb#L181-L183
def
workfile_path
(
for_file
=
original_filename
)
# To be safe, keep this directory outside of the the cache directory
# because calling CarrierWave.clean_cache_files! will remove any files in
# the cache directory.
File
.
join
(
work_dir
,
cache_id
,
version_name
.
to_s
,
for_file
)
end
end
end
spec/uploaders/records_uploads_spec.rb
View file @
609fc37b
...
...
@@ -5,8 +5,11 @@ describe RecordsUploads do
class
RecordsUploadsExampleUploader
<
GitlabUploader
include
RecordsUploads
::
Concern
storage_options
Gitlab
.
config
.
uploads
storage
:file
def
dynamic_segment
'co/fe/ee'
end
end
RecordsUploadsExampleUploader
.
new
(
build_stubbed
(
:user
))
...
...
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