View Issue Details

IDProjectCategoryView StatusLast Update
0010611mantisbtlocalizationpublic2009-06-23 15:26
ReporterKirill Assigned Todhx  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Versiongit trunk 
Target Version1.2.0rc1Fixed in Version1.2.0rc1 
Summary0010611: Attach not recognize correctly
Description

I upload Word, Image files, but they show as Plain Text.
Example, in attach

TagsNo tags attached.
Attached Files
attach.png (24,024 bytes)   
attach.png (24,024 bytes)   
Issue10611.patch (1,072 bytes)   
From 42c60a820afd4e008b7c9cd4606ca543bedbbb00 Mon Sep 17 00:00:00 2001
From: Kirill Krasnov <krasnovforum@gmail.com>
Date: Tue, 23 Jun 2009 06:52:17 +0300
Subject: [PATCH] UTF8 wrapper for unicode filename in getting extension

---
 core/file_api.php |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/file_api.php b/core/file_api.php
index 4ad5c5f..69de9fa 100644
--- a/core/file_api.php
+++ b/core/file_api.php
@@ -842,17 +842,17 @@ function file_get_extension( $p_filename ) {
 	$dot_found = false;
 	$i = utf8_strlen( $p_filename ) - 1;
 	while( $i >= 0 ) {
-		if( '.' == $p_filename[$i] ) {
+		if( '.' == utf8_substr($p_filename,$i,1) ) {
 			$dot_found = true;
 			break;
 		}
 
 		# found a directory marker before a period.
-		if(( $p_filename[$i] == "/" ) || ( $p_filename[$i] == "\\" ) ) {
+		if(( utf8_substr($p_filename,$i,1) == "/" ) || ( utf8_substr($p_filename,$i,1) == "\\" ) ) {
 			return '';
 		}
 
-		$ext = $p_filename[$i] . $ext;
+		$ext = utf8_substr($p_filename,$i,1) . $ext;
 		$i--;
 	}
 
-- 
1.6.3.2.1299.gee46c

Issue10611.patch (1,072 bytes)   

Relationships

related to 0012509 closeddhx replacement for file_get_extension 

Activities

Kirill

Kirill

2009-06-22 23:56

reporter   ~0022229

Last edited: 2009-06-23 05:07

I use this Issue10611.patch

Related Changesets

MantisBT: master 735dbd5c

2009-06-23 05:38

dhx


Details Diff
Fix 0010611: file extension check fails with UTF-8

Rewrite file_get_extension to work with UTF-8 file names and file
extensions. Also make file_check_type use file_get_extension instead of
using it's own extraction method.

Thanks Kirill for reporting this bug!
Affected Issues
0010611
mod - core/file_api.php Diff File