about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-02-23 10:56:38 +0000
committerEric Wong <e@80x24.org>2019-02-23 11:03:00 +0000
commit1c8b2e78042d774a199faa18679c22547b13420e (patch)
tree7339c2e37cbb4682c4d762491a30521c3bdb8455 /lib
parent1dba4001f662fb2511db2cbc9db17e1d5fefe3e1 (diff)
downloadpublic-inbox-1c8b2e78042d774a199faa18679c22547b13420e.tar.gz
CSS specified by the BOFH must never take precedence over
what a user sets in userContent.css.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/WWW.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index cbaf8845..7ed4f654 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -512,8 +512,9 @@ sub stylesheets_prepare ($$) {
                 if (defined $attr->{href}) {
                         $inline_ok = 0;
                 } else {
-                        open(my $fh, '<', $_) or do {
-                                warn "failed to open $_: $!\n";
+                        my $fn = $_;
+                        open(my $fh, '<', $fn) or do {
+                                warn "failed to open $fn: $!\n";
                                 next;
                         };
                         my ($key) = (m!([^/]+?)(?:\.css)?\z!i);
@@ -523,6 +524,13 @@ sub stylesheets_prepare ($$) {
                                 $ctime = sprintf('%x',(stat($fh))[10]);
                                 $local = $mini->($local);
                         }
+
+                        # do not let BOFHs override userContent.css:
+                        if ($local =~ /!\s*important\b/i) {
+                                warn "ignoring $fn since it uses `!important'\n";
+                                next;
+                        }
+
                         $css_map->{$key} = $local;
                         $attr->{href} = "$upfx$key.css?$ctime";
                         if (defined($attr->{title})) {