Commit ec712319 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed download filename

parent 14189982
......@@ -163,6 +163,17 @@ class ProxyController extends Controller
$contentEncoding = stripos($contentTypeHeader, "charset=") !== false ? trim(substr($contentTypeHeader, stripos($contentTypeHeader, "charset=") + 8)) : null;
$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) {
case 'text/html':
# It's a html Document
......@@ -195,6 +206,7 @@ class ProxyController extends Controller
case 'application/vnd.ms-fontobject':
case 'application/x-font-ttf':
case 'application/x-www-form-urlencoded':
case 'application/zip':
case 'binary/octet-stream':
# Nothing to do with Images: Just return them
break;
......@@ -206,6 +218,7 @@ class ProxyController extends Controller
break;
default:
# We have no Parser for this one. Let's respond:
dd("test");
abort(500, $contentType . " " . $targetUrl);
break;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment