1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 05:15:55 +00:00

send_local_file: add application/octet-stream hack

cached_url: return original requested filename to save as
This commit is contained in:
Andrew Dolgov
2018-08-16 12:16:51 +03:00
parent 163b50b15f
commit 88adf3da1b
2 changed files with 10 additions and 3 deletions

6
classes/handler/public.php Normal file → Executable file
View File

@@ -934,17 +934,17 @@ class Handler_Public extends Handler {
}
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
$hash = preg_replace("/\.[^\.]*$/", "", $hash);
$hash = preg_replace("/\.[^\.]*$/", "", $req_filename);
if ($hash) {
$filename = CACHE_DIR . '/images/' . $hash;
if (file_exists($filename)) {
header("Content-Disposition: inline; filename=\"$hash\"");
header("Content-Disposition: inline; filename=\"$req_filename\"");
send_local_file($filename);