Changeset 5769 in subversion


Ignore:
Timestamp:
Jan 13, 2012 6:21:45 AM (17 months ago)
Author:
alec
Message:
  • Make mime type detection based on filename extension to be case-insensitive
Location:
trunk/roundcubemail
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r5755 r5769  
    22=========================== 
    33 
     4- Make mime type detection based on filename extension to be case-insensitive 
    45- Fix failure on MySQL database upgrade from 0.7 - text column can't have default value (#1488300) 
    56- Added address book widget on compose screen 
  • trunk/roundcubemail/program/include/main.inc

    r5733 r5769  
    16281628 
    16291629  $classes = array($primary ? $primary : 'unknown'); 
    1630   if ($secondary) 
     1630  if ($secondary) { 
    16311631    $classes[] = $secondary; 
    1632   if (preg_match('/\.([a-z0-9]+)$/', $filename, $m)) 
     1632  } 
     1633  if (preg_match('/\.([a-z0-9]+)$/i', $filename, $m)) { 
    16331634    $classes[] = $m[1]; 
    1634  
    1635   return join(" ", $classes); 
     1635  } 
     1636 
     1637  return strtolower(join(" ", $classes)); 
    16361638} 
    16371639 
  • trunk/roundcubemail/program/include/rcube_shared.inc

    r5713 r5769  
    363363    $mime_magic = rcmail::get_instance()->config->get('mime_magic'); 
    364364    $mime_ext = @include(RCMAIL_CONFIG_DIR . '/mimetypes.php'); 
    365     $suffix = $name ? substr($name, strrpos($name, '.')+1) : '*'; 
    366365 
    367366    // use file name suffix with hard-coded mime-type map 
    368     if (is_array($mime_ext)) { 
    369         $mime_type = $mime_ext[$suffix]; 
    370     } 
     367    if (is_array($mime_ext) && $name) { 
     368        if ($suffix = substr($name, strrpos($name, '.')+1)) { 
     369            $mime_type = $mime_ext[strtolower($suffix)]; 
     370        } 
     371    } 
     372 
    371373    // try fileinfo extension if available 
    372374    if (!$mime_type && function_exists('finfo_open')) { 
     
    379381        } 
    380382    } 
     383 
    381384    // try PHP's mime_content_type 
    382385    if (!$mime_type && !$is_stream && function_exists('mime_content_type')) { 
    383386      $mime_type = @mime_content_type($path); 
    384387    } 
     388 
    385389    // fall back to user-submitted string 
    386390    if (!$mime_type) { 
Note: See TracChangeset for help on using the changeset viewer.