apple / cups

Apple CUPS Sources
https://www.cups.org
Apache License 2.0
1.96k stars 463 forks source link

cups.css file is detected on Linux as x-csource, not text/css #4593

Closed michaelrsweet closed 9 years ago

michaelrsweet commented 9 years ago

Version: 2.0.2 CUPS.org User: alexk

When i compile and install CUPS 2.0.2 on Ubuntu 12.04, its web interface is broken because cups.css doesn't load.

Browser says: The stylesheet https://printserver/cups.css was not loaded because its MIME type, "application/x-csource", is not "text/css".

$ file -l /usr/share/cups/doc-root/cups.css

Text patterns: Strength = 250 : Tenex C shell script text executable [text/x-shellscript] Strength = 250 : new awk script text executable [text/x-nawk] Strength = 250 : GNU awk script text executable [text/x-gawk] Strength = 250 : Bourne-Again shell script text executable [text/x-shellscript] CUPS reports the same mime type in error log: D [23/Feb/2015:18:31:07 +0000] [Client 48] filename="/usr/share/cups/doc-root/cups.css", type=application/x-csource D [23/Feb/2015:18:31:07 +0000] [Client 48] cupsdSendHeader: code=200, type="application/x-csource", auth_type=0 Removing /\* Layout CSS */ comment from the top of the cups.css file workarounds the problem.
michaelrsweet commented 9 years ago

CUPS.org User: mike

Alex,

Does your mime.types file have the following rule for application/x-csource?

application/x-csource c cxx cpp cc C h hpp \ printable(0,1024) + ! css + \ (string(0,/*) string(0,//) string(0,#include) contains(0,1024,<0a>#include) \ string(0,#define) contains(0,1024,<0a>#define))

The "! css" part should prevent this rule from matching a .css file with C comments.

michaelrsweet commented 9 years ago

CUPS.org User: alexk

Yes, it does contain it, and I see ! css part there, but it doesn't help. I also tried to move the line "text/css css" higher than this one hoping it would be matched first, but it didn't help either.

michaelrsweet commented 9 years ago

CUPS.org User: mike

Still unable to reproduce on my end. All I can guess is that you have old MIME types files in /etc/cups or /usr/share/cups/mime that are causing the typing to be done incorrectly.

jraschke commented 7 years ago

Hi

JFYI : I got this css-error after debian dist upgrade jessie --> stretch. Reason: very old mime.types in /etc/cups as Mike guessed above

Gruss, Juergen

ghost commented 5 years ago

Still present for me in Debian 9 and CUPS version 2.2.1-8+deb9u3. Manually removing mime.types and mime.convs files from /etc/cups (like suggested in Debian Bug report logs - #792731) let the CUPS admin web interface use the CSS like expected (after a cupsd restart) again.

Sprinterfreak commented 5 years ago

Fixed it for me

# Remove files
rm /usr/share/cups/mime/mime.convs /usr/share/cups/mime/mime.types
rm /etc/cups/mime.convs /etc/cups/mime.types
# Get fresh files from github
wget -O /etc/cups/mime.types https://raw.githubusercontent.com/apple/cups/master/conf/mime.types
wget -O /etc/cups/mime.convs https://raw.githubusercontent.com/apple/cups/master/conf/mime.convs.in
systemctl restart cups