summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm18
1 files changed, 12 insertions, 6 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index b58f83626..35ccf0996 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -31,6 +31,7 @@ use Cwd qw(abs_path);
use MIME::Base64;
use Date::Format ();
use Digest::MD5 qw(md5_hex);
+use Encode qw(encode_utf8);
use File::Basename qw(basename dirname);
use File::Find;
use File::Path qw(rmtree mkpath);
@@ -537,12 +538,13 @@ sub _concatenate_css {
# build minified files
my @minified;
+ my @md5s;
foreach my $source (@sources) {
next unless -e "$cgi_path/$files{$source}";
my $file = $skins_path . '/' . md5_hex($source) . '.css';
if (!-e $file) {
my $content = read_text("$cgi_path/$files{$source}");
-
+ push(@md5s, md5_hex(encode_utf8($content)));
# minify
$content =~ s{/\*.*?\*/}{}sg; # comments
$content =~ s{(^\s+|\s+$)}{}mg; # leading/trailing whitespace
@@ -556,8 +558,10 @@ sub _concatenate_css {
push @minified, $file;
}
- # concat files
- my $file = $skins_path . '/' . md5_hex(join(' ', @sources)) . '.css';
+ # concat files, use md5s to detect content changes
+ my $file = $skins_path . '/' . md5_hex(join(' ', @md5s)) . '.css';
+ Bugzilla->logger->info("checking concat $file");
+ trick_taint($file);
if (!-e $file) {
my $content = '';
foreach my $source (@minified) {
@@ -602,12 +606,13 @@ sub _concatenate_js {
# build minified files
my @minified;
+ my @md5s;
foreach my $source (@$sources) {
next unless -e "$cgi_path/$files{$source}";
my $file = $skins_path . '/' . md5_hex($source) . '.js';
if (!-e $file) {
my $content = read_text("$cgi_path/$files{$source}");
-
+ push(@md5s, md5_hex(encode_utf8($content)));
if ($file !~ m{\.min\.}) {
# minimal minification
## BUGBUG unsafe for things like: ",*/*"
@@ -622,8 +627,9 @@ sub _concatenate_js {
push @minified, $file;
}
- # concat files
- my $file = $skins_path . '/' . md5_hex(join(' ', @$sources)) . '.js';
+ # concat files, use md5s to detect content changes
+ my $file = $skins_path . '/' . md5_hex(join(' ', @md5s)) . '.js';
+ trick_taint($file);
if (!-e $file) {
my $content = '';
foreach my $source (@minified) {