1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-01-06 18:09:14 +00:00

add DiskCache.getUrl() and use it in a bunch of places

This commit is contained in:
Andrew Dolgov
2019-08-13 12:39:21 +03:00
parent 7602819b98
commit b1dd38f880
4 changed files with 7 additions and 16 deletions

View File

@@ -676,7 +676,7 @@ class Article extends Handler_Protected {
while ($line = $sth->fetch()) {
if (file_exists(CACHE_DIR . '/images/' . sha1($line["content_url"]))) {
$line["content_url"] = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($line["content_url"]);
$line["content_url"] = DiskCache::getUrl(sha1($line["content_url"]));
}
array_push($rv, $line);

View File

@@ -56,4 +56,8 @@ class DiskCache {
public function send($filename) {
return send_local_file($this->getFullPath($filename));
}
static public function getUrl($filename) {
return get_self_url_prefix() . "/public.php?op=cached_url&file=" . $filename;
}
}

View File

@@ -1202,7 +1202,7 @@ class Handler_Public extends Handler {
}
function cached_url() {
@$req_filename = basename($_GET['hash']);
@$req_filename = basename($_GET['file']);
// we don't need an extension to find the file, hash is a complete URL
$hash = preg_replace("/\.[^\.]*$/", "", $req_filename);