From 33184d4a01f4b95fd7f319d11cd4b71a765885b9 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 1 Apr 2010 03:05:17 +0200 Subject: mimetype: add --orig-name and use it Signed-off-by: Florian Pritz --- scripts/mimetype | 9 +++++++++ system/application/models/file_mod.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/mimetype b/scripts/mimetype index ec191adc8..43c69ebc6 100755 --- a/scripts/mimetype +++ b/scripts/mimetype @@ -22,6 +22,7 @@ my %opts = ( 'stdin' => [''], 'brief' => ['b'], 'namefile' => ['f', 1], + 'orig-name' => ['', 1], 'noalign' => ['N'], 'describe' => ['d'], 'file-compat' => [''], @@ -192,6 +193,14 @@ foreach my $file (@ARGV) { print $format->($file, $m), "\n" if $m; } } + elsif ($args{'orig-name'}) { + my $type = globs($args{'orig-name'}); + if ($type ne "") { + print $format->($file, $type), "\n"; + } else { + print $format->($file, mimetype($f)), "\n"; + } + } else { print $format->($file, mimetype($f)), "\n" } } diff --git a/system/application/models/file_mod.php b/system/application/models/file_mod.php index bc7168e27..41959a5d2 100644 --- a/system/application/models/file_mod.php +++ b/system/application/models/file_mod.php @@ -153,7 +153,7 @@ class File_mod extends Model { } // MODIFIED SINCE SUPPORT -- END - $type = exec('/usr/bin/perlbin/vendor/mimetype -b '.escapeshellarg($file)); + $type = exec(FCPATH.'scripts/mimetype -b --orig-name '.escapeshellarg($filedata['filename']).' '.escapeshellarg($file)); if (!$mode && substr_count(ltrim($this->uri->uri_string(), "/"), '/') >= 1) { $mode = $this->mime2extension($type); -- cgit v1.2.3-24-g4f1b