Loading...
 
Skip to main content

mime type detection for upper case filenames

Status
Pending
Subject
mime type detection for upper case filenames
Version
12.x
14.x
15.x
Category
  • Error
Feature
File Gallery (elFinder or standard UI)
Resolution status
Please retest
Submitted by
wellenvogel
Volunteered to solve
Jonny Bradley
Lastmod by
Jonny Bradley
Rating
(0)
Related-to
Description

When uploading files in the file gallery (XXX.JPG) with uppercase filenames they will be detected as application/octet-stream (XAMPP on Windows 7).
Instead they should be recognized as jpeg.

Proposed patch (i.e. convert extension to lower case before testing for mime type).

--- mimelib-ori.php     2013-12-07 13:07:10.000000000 +0100
+++ mimelib.php 2013-12-07 13:08:07.000000000 +0100
@@ -101,7 +101,7 @@
                global $mimetypes; include_once('lib/mime/mimetypes.php');

                if (isset($mimetypes)) {
-                       $ext = $this->get_extension($filename);
+                       $ext = strtolower($this->get_extension($filename));
                        $mimetype = isset($mimetypes[$ext]) ? $mimetypes[$ext] : '';

                        if (!empty($mimetype)) {
Solution
r58235 in tiki 15.x?
Importance
4
Easy to solve?
10 easy
Priority
40
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
5037
Created
Saturday 07 December, 2013 12:25:37 UTC
by wellenvogel
LastModif
Thursday 07 April, 2016 12:11:30 UTC


Show PHP error messages