summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-03-23 18:26:43 +0300
committerAndrew Dolgov <[email protected]>2017-03-23 18:26:43 +0300
commit9594ea68751c7f887dfabcf4e1411a2da1283ed5 (patch)
treebffc0334e282d210e2559247673a9dd9f7cc7ebd /include
parentdf994ac333abc6dc14134e6d9c18e6fdbb43b1c8 (diff)
add cosmetic suffixes back for cached url links
Diffstat (limited to 'include')
-rw-r--r--include/functions2.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/functions2.php b/include/functions2.php
index 28e182f8d..844693654 100644
--- a/include/functions2.php
+++ b/include/functions2.php
@@ -912,7 +912,19 @@
$cached_filename = CACHE_DIR . '/images/' . sha1($src);
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')) {
$entry->removeAttribute('srcset');