[chora] file extension bug + patch

Ahmed ashihab at alcahest.com
Sat Oct 18 07:04:00 PDT 2003


Found a small bug that was preventing files like .c and .vhd from being
identified correctly in chora (latest CVS today).

Instead of identifying them as text and using the appropriate source
colouring tool they where identified as octet-stream and downloaded instead
of viewed.

anyway it turns out to be a trivial bug in /lib/MIME/Magic.php

--snip
*** Magic.php   Sat Oct 18 14:59:22 2003
--- Magic.php.new       Sat Oct 18 14:57:57 2003
***************
*** 105,111 ****
          $pos = strrpos($filename, '.');
          if (!empty($pos)) {
              $type = MIME_Magic::extToMIME(substr($filename, $pos + 1));
!             if (!stristr($type, 'x-extension')) {
                  return $type;
              }
          }
--- 105,111 ----
          $pos = strrpos($filename, '.');
          if (!empty($pos)) {
              $type = MIME_Magic::extToMIME(substr($filename, $pos + 1));
!             if (stristr($type, 'x-extension')) {
                  return $type;
              }
          }

--snip

Ahmed...





More information about the chora mailing list