The url() function does not seem to decode a URL, at least when creating
local files. For example, if "%20" is used instead of " ", the "%20" will
be included verbatim in the file name.  In my opinion, it should perform
the replacement, i.e., the equivalent of URLdecode(). And really, it should
throw an error if someone passes an invalid URL, like one with a space
(which currently works).

> u <- url("file:///tmp/foo%20bar.test")
> writeLines("test", u)
> close(u)
> tools::list_files_with_exts("/tmp", "test")
[1] "/tmp/foo%20bar.test"

Probably should not work:
> u <- url("file:///tmp/foo bar.test2") # invalid URL
> writeLines("test", u)
> close(u)
> tools::list_files_with_exts("/tmp", "test2")
[1] "/tmp/foo bar.test2"

Michael

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to