]> git.wh0rd.org - tt-rss.git/commitdiff
add cosmetic suffixes back for cached url links
authorAndrew Dolgov <noreply@fakecake.org>
Thu, 23 Mar 2017 15:26:43 +0000 (18:26 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Thu, 23 Mar 2017 15:26:43 +0000 (18:26 +0300)
include/functions2.php

index 28e182f8d9b1783a9c7742484db1657ad61b8a53..844693654801a59fa0261ebba433830590d58c21 100644 (file)
                                $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');