check for the existence of file instead of url

A resource has no file, when a default_url is provided. However if you check for the presence of url, it will pass it. This will cause an error (cannot read file from nill class).

Checking for the presence of file solves this.