only pre-pending root for path fragments

When a url is passed in that contains spaces the validate function fails and falls through further down the code, however at this point the root is always pre-pended, even when one already exists.

This patch checks the passed in path to make sure it's not a full url:

Example:
http://foo.com/bar baz/file -> http://foo.com/http://foo.com/bar%20baz/file

This is an invalid url, granted, but the behavior currently will convert it to an even less valid one.

I updated the code to check if the $path starts with an 'http' string, if it does then root will be set to an empty string and $path will be left alone in the next step.
Please remove this whitespace, then squash to one commit.