Fix error with spaces in path/filename

When loading files from a remote server, sometimes the path or filename
has a space, this handles the otherwise annoying
“java.net.MalformedURLException: no protocol” error.