mirror of https://tt-rss.org/git/tt-rss.git
send_local_file: add application/octet-stream hack
cached_url: return original requested filename to save as
This commit is contained in:
parent
163b50b15f
commit
88adf3da1b
|
@ -934,17 +934,17 @@ class Handler_Public extends Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
function cached_url() {
|
function cached_url() {
|
||||||
@$hash = basename($_GET['hash']);
|
@$req_filename = basename($_GET['hash']);
|
||||||
|
|
||||||
// we don't need an extension to find the file, hash is a complete URL
|
// we don't need an extension to find the file, hash is a complete URL
|
||||||
$hash = preg_replace("/\.[^\.]*$/", "", $hash);
|
$hash = preg_replace("/\.[^\.]*$/", "", $req_filename);
|
||||||
|
|
||||||
if ($hash) {
|
if ($hash) {
|
||||||
|
|
||||||
$filename = CACHE_DIR . '/images/' . $hash;
|
$filename = CACHE_DIR . '/images/' . $hash;
|
||||||
|
|
||||||
if (file_exists($filename)) {
|
if (file_exists($filename)) {
|
||||||
header("Content-Disposition: inline; filename=\"$hash\"");
|
header("Content-Disposition: inline; filename=\"$req_filename\"");
|
||||||
|
|
||||||
send_local_file($filename);
|
send_local_file($filename);
|
||||||
|
|
||||||
|
|
|
@ -2574,6 +2574,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$mimetype = mime_content_type($filename);
|
$mimetype = mime_content_type($filename);
|
||||||
|
|
||||||
|
// this is hardly ideal but 1) only media is cached in images/ and 2) seemingly only mp4
|
||||||
|
// video files are detected as octet-stream by mime_content_type()
|
||||||
|
|
||||||
|
if ($mimetype == "application/octet-stream")
|
||||||
|
$mimetype = "video/mp4";
|
||||||
|
|
||||||
header("Content-type: $mimetype");
|
header("Content-type: $mimetype");
|
||||||
|
|
||||||
$stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT";
|
$stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT";
|
||||||
|
|
Loading…
Reference in New Issue