Ticket #1842 (closed Bug: fixed)

Opened 3 months ago

Last modified 2 months ago

Filename escape/encode problem causes XML error in file browser

Reported by: Dynom Assigned to: wwalc
Priority: Normal Milestone: FCKeditor 2.6
Component: File Browser Version: FCKeditor 2.5.1
Keywords: Confirmed Review+ Cc:

Description

As briefly described in this topic: http://www.fckeditor.net/forums/viewtopic.php?f=6&t=8397#p22183 Filenames with special characters in it cause the XML used in the iBrowser to be invalid which breaks IE browsers.

Attachments

1842.patch (4.9 kB) - added by wwalc on 03/13/08 14:54:59.

Change History

02/14/08 13:08:33 changed by w.olchawa

  • keywords changed from ie ibrowser file browser xml encode escape to Pending.
  • priority changed from High to Normal.

Hi!

I've viewed the forum but I was unable to find what kind of "special characters" is this bug referring to. Please write if I have missed it in the forum.

Thanks

02/24/08 12:22:43 changed by alfonsoml

Wiktor:

I've tested to upload a file with Spanish letters to the images/test folder and now IE fails to load that folder. Loading http://www.fckeditor.net/fckeditor/editor/filemanager/connectors/php/connector.php?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=%2Ftest%2F&uuid=1203851904656 in IE7 says that there are some invalid characters.

The picture was uploaded with IE7 also.

In Firefox the list of files is shown, but instead of the proper letters it shows ? for the special characters.

So if the file gets deleted and you need to test it just drop me a note and I'll upload it again.

Note: I've uploaded that same file to the CKFinder demo and it works fine there.

02/24/08 12:23:58 changed by alfonsoml

  • keywords changed from Pending to Confirmed.

02/25/08 16:58:59 changed by wwalc

  • owner set to wwalc.
  • status changed from new to assigned.

03/13/08 14:54:04 changed by wwalc

This issue has been also described in #1036.

The main problem is that in some of the html files used by file browser utf-8 headers were missing:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Because of that, IE sent file names in its internal system encoding, whilst everyting was working fine in Firefox (used utf-8 as a defult to send names of uploaded files). Acutally FCKeditor could work fine even in IE, if utf-8 encoding was forced by apache configuration.

Anyway, utf-8 headers must be set in all pages which are responsible for managing files. This will fix problems with uploading files in IE in the future.

However, we have still unresolveable problem with files that have been already uploaded (...or have been uploaded by poor FTP client). Their name may be an invalid utf-8 string, which breaks XML responses in IE (Firefox ignores that problem). To fix that, ConvertToXmlAttribute function on *nix systems must check whether file name is a valid utf string: if not, encode it *somehow*. We have no information what was the initial encoding that IE had used, so we could use utf8_encode which is available in core in all PHP versions. It encodes string assuming that given string is encoded in ISO-8859-1.

Unfortunately it means that if someone uploaded file in IE and his Windows used different charset than ISO-8859-1, his file will be displayed, but its name will be wrong (due to wrong encoding used in conversion). But this is still a lot better that being unable to display the list of files.

To completely fix this issue, we would have to be able to sent non-utf file names in XML responses, so file names would have to be sent in rawurlencoded format.

03/13/08 14:54:59 changed by wwalc

  • attachment 1842.patch added.

03/13/08 14:56:49 changed by wwalc

The patch above fixes all that we can fix with current behaviour of file browser. As I wrote, to completely solve this issue, file names would have to be send in a safe format (rawurlencoded).

03/13/08 14:59:49 changed by wwalc

  • keywords changed from Confirmed to Confirmed Review?.

03/18/08 13:04:27 changed by wwalc

  • milestone set to FCKeditor 2.6.

03/18/08 13:05:43 changed by fredck

  • keywords changed from Confirmed Review? to Confirmed Review+.

03/19/08 20:50:53 changed by wwalc

Fixed with [1736].

03/19/08 20:51:01 changed by wwalc

  • status changed from assigned to closed.
  • resolution set to fixed.