commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Bentmann (JIRA)" <j...@apache.org>
Subject [jira] Updated: (IO-166) Fix URL decoding in FileUtils.toFile()
Date Fri, 30 May 2008 08:49:45 GMT

     [ https://issues.apache.org/jira/browse/IO-166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Benjamin Bentmann updated IO-166:
---------------------------------

    Attachment: IO-166.patch

New patch to also address the following issues:
# URL decoding should use UTF-8
# URL decoding should be lenient

Rationale for 1. is to bring the method in sync with the behavior of the decoding done by
the JDK, i.e. the output from
{code:java}
URI url = new URI("file:/home/%C3%A4%C3%B6%C3%BC%C3%9F");
System.out.println(new File(url));
System.out.println(FileUtils.toFile(url.toURL()));
{code}
is currently
{noformat}
/home/äöüß
/home/äöü�
{noformat}

Rationale for 2. is to better work with invalid URLs returned by bad class loaders. There
are still enough class loader implementations out that will return a URL like "file:/<snip>/%file.txt"
when queried for a resource named "%file.txt", i.e. the URL is not encoded at all and can
as such potentially include literal percent characters. Hence I believe it is preferable for
the method to simply pass such characters literally through instead of failing with an exception.

> Fix URL decoding in FileUtils.toFile()
> --------------------------------------
>
>                 Key: IO-166
>                 URL: https://issues.apache.org/jira/browse/IO-166
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Benjamin Bentmann
>            Priority: Minor
>         Attachments: IO-166.patch, IO-166.patch
>
>
> The sequence "%2520" should decode to "%20".

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message