diff --git a/lib.js b/lib.js index 7bfaaf6..4bb3747 100755 --- a/lib.js +++ b/lib.js @@ -611,15 +611,15 @@ export const downloadImage = async (url, basename, source, view) => { return url } - let relativePath = Path.join(view.imageStoreDirectory, basename + extension) - let path = Path.join(view.path, relativePath) + let pathname = Path.join(view.imageStoreDirectory, basename + extension) + let path = Path.join(view.path, pathname) const download = () => write(path, response.body) - .then(annotate( `Downloaded ${relativePath}`)) + .then(annotate( `Downloaded ${pathname}`)) // TODO: See if the image is downloaded before even trying to download it view.batch.add(FS.access(path).catch(download)) - return relativePath + return pathname } else { console.error( createNetworkingError(response) ) return url