Re: [racket-dev] Potential bug in path->url

2012-11-06 Thread Jay McCarthy
I looked at your patch and it looks good overall. Could you add a test
case or two to collects/tests/url.rkt (around line 184) and verify
that the other test cases continue to pass?

Jay

On Tue, Nov 6, 2012 at 3:43 PM, Philippe Mechaï
 wrote:
> Hi,
>
> I think there is a bug in the path->url function (from net/url).
>
>> (url->string (path->url "/tmp"))
> "file:///tmp"
>> (url->string (path->url "/tmp/"))
> "file:///tmp"
>
> As you can see the resulting URL is the same even if the path is a directory
> path.
> I believe that in the second case the URL should be "file:///tmp/".
>
> This lead to an unexpected behaviour when using the result of path->url with
> combine-url/relative:
>
>> (url->string (combine-url/relative (path->url "/tmp/") "foo.txt"))
> "file:///foo.txt"
>
> I've made a fix and created the pull request #166 on GitHub
> (https://github.com/plt/racket/pull/166)
>
> Could you please merge this change ?
>
> Also, it should be noted that the path->url and url->path are not symmetric
> as one could expect.
> Before my modification:
>   (url->path (path->url "/tmp/")) => #
> After:
>   (url->path (path->url "/tmp/")) => #
>
> I don't think it is a real problem but I thought it was worth mentioning.
>
> Regards,
> Philippe Mechaï
>
>
>
>
>
>
>
> _
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
>



-- 
Jay McCarthy 
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Potential bug in path->url

2012-11-06 Thread Philippe Mechaï
Hi,

I think there is a bug in the path->url function (from net/url).

> (url->string (path->url "/tmp"))
"file:///tmp"
> (url->string (path->url "/tmp/"))
"file:///tmp"

As you can see the resulting URL is the same even if the path is a
directory path.
I believe that in the second case the URL should be "file:///tmp/".

This lead to an unexpected behaviour when using the result of path->url
with combine-url/relative:

> (url->string (combine-url/relative (path->url "/tmp/") "foo.txt"))
"file:///foo.txt"

I've made a fix and created the pull request #166 on GitHub (
https://github.com/plt/racket/pull/166)

Could you please merge this change ?

Also, it should be noted that the path->url and url->path are not symmetric
as one could expect.
Before my modification:
  (url->path (path->url "/tmp/")) => #
After:
  (url->path (path->url "/tmp/")) => #

I don't think it is a real problem but I thought it was worth mentioning.

Regards,
Philippe Mechaï
_
  Racket Developers list:
  http://lists.racket-lang.org/dev