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
0e945670
Commit
0e945670
authored
May 13, 2020
by
Jennifer Louie
Committed by
Stan Hu
May 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the failing spec example
Prevent LfsObjectUploader from allowing the tested path
parent
4e5e26a0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
2 deletions
+21
-2
ee/changelogs/unreleased/212632-add-LFS-workhorse-upload-path.yml
...elogs/unreleased/212632-add-LFS-workhorse-upload-path.yml
+5
-0
ee/spec/lib/gitlab/middleware/multipart_spec.rb
ee/spec/lib/gitlab/middleware/multipart_spec.rb
+4
-2
lib/gitlab/middleware/multipart.rb
lib/gitlab/middleware/multipart.rb
+1
-0
spec/lib/gitlab/middleware/multipart_spec.rb
spec/lib/gitlab/middleware/multipart_spec.rb
+11
-0
No files found.
ee/changelogs/unreleased/212632-add-LFS-workhorse-upload-path.yml
0 → 100644
View file @
0e945670
---
title
:
Add LFS workhorse upload path to allowed upload paths
merge_request
:
31794
author
:
type
:
fixed
ee/spec/lib/gitlab/middleware/multipart_spec.rb
View file @
0e945670
...
...
@@ -30,9 +30,11 @@ describe Gitlab::Middleware::Multipart do
RSpec
.
shared_examples
'not allowing the multipart upload when package upload path is used'
do
it
'does not allow files to be uploaded'
do
with_tmp_dir
(
'tmp/uploads'
,
storage_path
)
do
|
dir
,
env
|
# with_tmp_dir set the same workhorse_upload_path for all Uploaders,
# so we have to prevent JobArtifactUploader to allow the tested path
# with_tmp_dir sets the same workhorse_upload_path for all Uploaders,
# so we have to prevent JobArtifactUploader and LfsObjectUploader to
# allow the tested path
allow
(
JobArtifactUploader
).
to
receive
(
:workhorse_upload_path
).
and_return
(
Dir
.
tmpdir
)
allow
(
LfsObjectUploader
).
to
receive
(
:workhorse_upload_path
).
and_return
(
Dir
.
tmpdir
)
status
,
headers
,
body
=
middleware
.
call
(
env
)
...
...
lib/gitlab/middleware/multipart.rb
View file @
0e945670
...
...
@@ -110,6 +110,7 @@ module Gitlab
::
FileUploader
.
root
,
Gitlab
.
config
.
uploads
.
storage_path
,
JobArtifactUploader
.
workhorse_upload_path
,
LfsObjectUploader
.
workhorse_upload_path
,
File
.
join
(
Rails
.
root
,
'public/uploads/tmp'
)
]
end
...
...
spec/lib/gitlab/middleware/multipart_spec.rb
View file @
0e945670
...
...
@@ -195,6 +195,17 @@ describe Gitlab::Middleware::Multipart do
end
end
it
'allows files in the lfs upload path'
do
with_tmp_dir
(
'lfs-objects'
)
do
|
dir
,
env
|
expect
(
LfsObjectUploader
).
to
receive
(
:workhorse_upload_path
).
and_return
(
File
.
join
(
dir
,
'lfs-objects'
))
expect
(
app
).
to
receive
(
:call
)
do
|
env
|
expect
(
get_params
(
env
)[
'file'
]).
to
be_a
(
::
UploadedFile
)
end
middleware
.
call
(
env
)
end
end
it
'allows symlinks for uploads dir'
do
Tempfile
.
open
(
'two-levels'
)
do
|
tempfile
|
symlinked_dir
=
'/some/dir/uploads'
...
...
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