Happy New Year
[squirrelmail.git] / functions / attachment_common.php
index 724b59d673e177a6613d1fe1670c0c24d46fcda0..69f3e06e4d3d5d521da7d95780aa4f5e268a1126 100644 (file)
@@ -5,7 +5,7 @@
  *
  * This file provides the handling of often-used attachment types.
  *
- * @copyright 1999-2015 The SquirrelMail Project Team
+ * @copyright 1999-2021 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -93,6 +93,9 @@ register_attachment_common('text/html',      'link_html');
 register_attachment_common('text/x-vcard',   'link_vcard');
 register_attachment_common('text/directory', 'link_vcard');
 
+/* Register ics (calendar) */
+register_attachment_common('application/ics',  'link_text');
+
 /* Register rules for general types.
  * These will be used if there isn't a more specific rule available. */
 register_attachment_common('text/*',  'link_text');
@@ -265,11 +268,10 @@ function attachment_common_octet_stream(&$Args) {
 //FIXME: or at least we can move this hook up to the top of this file where $FileExtensionToMimeType is defined.  What else is this hook here for?  What plugins use it?
     do_hook('attachment_common-load_mime_types', $null);
 
-    preg_match('/\.([^.]+)$/', $Args[7], $Regs);
+    preg_match('/\.([^.]+)$/', $Args[6], $Regs);
 
     $Ext = '';
     if (is_array($Regs) && isset($Regs[1])) {
-        $Ext = $Regs[1];
         $Ext = strtolower($Regs[1]);
     }