Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
Proxy
Commits
ec712319
Commit
ec712319
authored
5 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
fixed download filename
parent
14189982
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/Http/Controllers/ProxyController.php
+13
-0
13 additions, 0 deletions
app/Http/Controllers/ProxyController.php
with
13 additions
and
0 deletions
app/Http/Controllers/ProxyController.php
+
13
−
0
View file @
ec712319
...
@@ -163,6 +163,17 @@ class ProxyController extends Controller
...
@@ -163,6 +163,17 @@ class ProxyController extends Controller
$contentEncoding
=
stripos
(
$contentTypeHeader
,
"charset="
)
!==
false
?
trim
(
substr
(
$contentTypeHeader
,
stripos
(
$contentTypeHeader
,
"charset="
)
+
8
))
:
null
;
$contentEncoding
=
stripos
(
$contentTypeHeader
,
"charset="
)
!==
false
?
trim
(
substr
(
$contentTypeHeader
,
stripos
(
$contentTypeHeader
,
"charset="
)
+
8
))
:
null
;
$contentEncoding
=
rtrim
(
$contentEncoding
,
";"
);
$contentEncoding
=
rtrim
(
$contentEncoding
,
";"
);
if
(
isset
(
$result
[
"header"
][
"content-disposition"
]))
{
if
(
stripos
(
$result
[
"header"
][
"content-disposition"
],
"filename="
)
===
false
)
{
$basename
=
basename
(
parse_url
(
$targetUrl
,
PHP_URL_PATH
));
$newHeader
=
$result
[
"header"
][
"content-disposition"
];
$newHeader
=
trim
(
$newHeader
);
$newHeader
=
rtrim
(
$newHeader
,
";"
);
$newHeader
.
=
"; filename="
.
$basename
;
$result
[
"header"
][
"content-disposition"
]
=
$newHeader
;
}
}
switch
(
$contentType
)
{
switch
(
$contentType
)
{
case
'text/html'
:
case
'text/html'
:
# It's a html Document
# It's a html Document
...
@@ -195,6 +206,7 @@ class ProxyController extends Controller
...
@@ -195,6 +206,7 @@ class ProxyController extends Controller
case
'application/vnd.ms-fontobject'
:
case
'application/vnd.ms-fontobject'
:
case
'application/x-font-ttf'
:
case
'application/x-font-ttf'
:
case
'application/x-www-form-urlencoded'
:
case
'application/x-www-form-urlencoded'
:
case
'application/zip'
:
case
'binary/octet-stream'
:
case
'binary/octet-stream'
:
# Nothing to do with Images: Just return them
# Nothing to do with Images: Just return them
break
;
break
;
...
@@ -206,6 +218,7 @@ class ProxyController extends Controller
...
@@ -206,6 +218,7 @@ class ProxyController extends Controller
break
;
break
;
default
:
default
:
# We have no Parser for this one. Let's respond:
# We have no Parser for this one. Let's respond:
dd
(
"test"
);
abort
(
500
,
$contentType
.
" "
.
$targetUrl
);
abort
(
500
,
$contentType
.
" "
.
$targetUrl
);
break
;
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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