Ensure that URLs can be downloaded.

Don't always make sure the thing ends with ".js". Add it if there is no
prefix, but don't if there is another (such as ".css").
If there is no output defined, use the URL

Rather than throwing ".js" in front of the search term, parse out the
filename from the URL, and make sure it has an extension. This was the
old behaviour which got lost in the rewrite.
Rename ensure file prefix method as it's not the prefix at all
update tests to match new behaviour