You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Andreas Heindl <an...@gmx.de> on 2013/03/30 09:48:00 UTC

[patch] Bug with spaces in file names in ApacheURLLister.java

Hello,

there is a bug in
apache-ivy-2.3.0-src.zip/apache-ivy-2.3.0/src/java/org/apache/ivy/util/url/ApacheURLLister.java

When parsing an file containing spaces, its href representation is 
encoded, whilst the text is unencoded. The check in line 177:

String strippedHref = href_dec.endsWith("/") ? href_dec.substring(0, 
href_dec.length() - 1) : href_dec;
String strippedText = text.endsWith("/") ? text.substring(0, 
text.length() - 1) : text;
if (!strippedHref.equalsIgnoreCase(strippedText)) {
     continue;

therefore is not successful.

Example:
href=bla%20und%20bub.dat
text=bla und bub.dat


Suggested patch is an Uri.decode(href):


String href_dec = Uri.decode(href);
String strippedHref = href_dec.endsWith("/") ? href_dec.substring(0, 
href_dec.length() - 1) : href_dec;
String strippedText = text.endsWith("/") ? text.substring(0, 
text.length() - 1) : text;
if (!strippedHref.equalsIgnoreCase(strippedText)) {
     continue;




Greetings,
  Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: [patch] Bug with spaces in file names in ApacheURLLister.java

Posted by Andreas Heindl <an...@gmx.de>.
sorry, better patch might be a replacement of href instead of 
introducing a temporary variable href_dec:

href = Uri.decode(href);
String strippedHref = href.endsWith("/") ? href.substring(0, 
href.length() - 1) : href;
...


On 3/30/2013 9:48 AM, Andreas Heindl wrote:
> Hello,
>
> there is a bug in
> apache-ivy-2.3.0-src.zip/apache-ivy-2.3.0/src/java/org/apache/ivy/util/url/ApacheURLLister.java
>
>
> When parsing an file containing spaces, its href representation is
> encoded, whilst the text is unencoded. The check in line 177:
>
> String strippedHref = href_dec.endsWith("/") ? href_dec.substring(0,
> href_dec.length() - 1) : href_dec;
> String strippedText = text.endsWith("/") ? text.substring(0,
> text.length() - 1) : text;
> if (!strippedHref.equalsIgnoreCase(strippedText)) {
>      continue;
>
> therefore is not successful.
>
> Example:
> href=bla%20und%20bub.dat
> text=bla und bub.dat
>
>
> Suggested patch is an Uri.decode(href):
>
>
> String href_dec = Uri.decode(href);
> String strippedHref = href_dec.endsWith("/") ? href_dec.substring(0,
> href_dec.length() - 1) : href_dec;
> String strippedText = text.endsWith("/") ? text.substring(0,
> text.length() - 1) : text;
> if (!strippedHref.equalsIgnoreCase(strippedText)) {
>      continue;
>
>
>
>
> Greetings,
>   Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org