add cosmetic suffixes back for cached url links

This commit is contained in:
Andrew Dolgov 2017-03-23 18:26:43 +03:00
parent df994ac333
commit 9594ea6875
1 changed files with 13 additions and 1 deletions

View File

@ -912,7 +912,19 @@
$cached_filename = CACHE_DIR . '/images/' . sha1($src); $cached_filename = CACHE_DIR . '/images/' . sha1($src);
if (file_exists($cached_filename)) { if (file_exists($cached_filename)) {
$src = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($src);
// this is strictly cosmetic
if ($entry->tagName == 'img') {
$suffix = ".png";
} else if ($entry->parentNode && $entry->parentNode->tagName == "video") {
$suffix = ".mp4";
} else if ($entry->parentNode && $entry->parentNode->tagName == "audio") {
$suffix = ".ogg";
} else {
$suffix = "";
}
$src = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($src) . $suffix;
if ($entry->hasAttribute('srcset')) { if ($entry->hasAttribute('srcset')) {
$entry->removeAttribute('srcset'); $entry->removeAttribute('srcset');