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
f45cf85f
Commit
f45cf85f
authored
Feb 13, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
0964138a
a77a1e1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
app/controllers/concerns/send_file_upload.rb
app/controllers/concerns/send_file_upload.rb
+1
-1
spec/controllers/concerns/send_file_upload_spec.rb
spec/controllers/concerns/send_file_upload_spec.rb
+17
-0
No files found.
app/controllers/concerns/send_file_upload.rb
View file @
f45cf85f
...
...
@@ -3,7 +3,7 @@
module
SendFileUpload
def
send_upload
(
file_upload
,
send_params:
{},
redirect_params:
{},
attachment:
nil
,
proxy:
false
,
disposition:
'attachment'
)
if
attachment
response_disposition
=
::
Gitlab
::
ContentDisposition
.
format
(
disposition:
'attachment'
,
filename:
attachment
)
response_disposition
=
::
Gitlab
::
ContentDisposition
.
format
(
disposition:
disposition
,
filename:
attachment
)
# Response-Content-Type will not override an existing Content-Type in
# Google Cloud Storage, so the metadata needs to be cleared on GCS for
...
...
spec/controllers/concerns/send_file_upload_spec.rb
View file @
f45cf85f
...
...
@@ -52,6 +52,23 @@ describe SendFileUpload do
end
end
context
'with inline image'
do
let
(
:filename
)
{
'test.png'
}
let
(
:params
)
{
{
disposition:
'inline'
,
attachment:
filename
}
}
it
'sends a file with inline disposition'
do
# Notice the filename= is omitted from the disposition; this is because
# Rails 5 will append this header in send_file
expected_params
=
{
filename:
'test.png'
,
disposition:
"inline; filename*=UTF-8''test.png"
}
expect
(
controller
).
to
receive
(
:send_file
).
with
(
uploader
.
path
,
expected_params
)
subject
end
end
context
'with attachment'
do
let
(
:filename
)
{
'test.js'
}
let
(
:params
)
{
{
attachment:
filename
}
}
...
...
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