From c66199ffd23c0cbf92022fc2447e244632ffade9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 1 Feb 2019 13:24:34 +0100 Subject: [PATCH] Add cache busters also to images used by templates (#6610) --- CHANGELOG | 1 + program/include/rcmail_output_html.php | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 85a4876c3..4a511a275 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,7 @@ CHANGELOG Roundcube Webmail - Prevent from using deprecated timezone names from jsTimezoneDetect - Force session.gc_probability=1 when using custom session handlers (#6560) - Support simple field labels (e.g. LetterHub examples) in csv imports (#6541) +- Add cache busters also to images used by templates (#6610) - Plugin API: Added 'raise_error' hook (#6199) - Plugin API: Added 'common_headers' hook (#6385) - Plugin API: Added 'ldap_connected' hook diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 7fe760aff..669812ae8 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -888,13 +888,12 @@ EOF; } /** - * Correct absolute paths in images and other tags - * add timestamp to .js and .css filename + * Correct absolute paths in images and other tags (add cache busters) */ protected function fix_paths($output) { return preg_replace_callback( - '!(src|href|background)=(["\']?)([a-z0-9/_.-]+)(["\'\s>])!i', + '!(src|href|background|data-src-[a-z]+)=(["\']?)([a-z0-9/_.-]+)(["\'\s>])!i', array($this, 'file_callback'), $output); } @@ -915,7 +914,7 @@ EOF; } // add file modification timestamp - if (preg_match('/\.(js|css)$/', $file, $m)) { + if (preg_match('/\.(js|css|less|ico|png|svg|jpeg)$/', $file, $m)) { $file = $this->file_mod($file); }