Properly handle the case when there is an error calling os.Stat and it's not a error because the file doesn't exist (it may be good to log this error some how, but I'm not sure the best way to do that so I left it out).
Properly parse the URL on Windows. On Windows, os.PathSeparator will be \. There are no \ characters in a URL, so parsing would fail and the created path would be weird and contain invalid characters on Windows. This will parse always using a /, so it should work on both Unix & Windows.
Two bug fixes:
Properly handle the case when there is an error calling
os.Stat
and it's not a error because the file doesn't exist (it may be good to log this error some how, but I'm not sure the best way to do that so I left it out).Properly parse the URL on Windows. On Windows,
os.PathSeparator
will be\
. There are no\
characters in a URL, so parsing would fail and the created path would be weird and contain invalid characters on Windows. This will parse always using a/
, so it should work on both Unix & Windows.