Fix clearCache in case of download failure

main
Jordi Boggiano 9 years ago
parent 502c5431a2
commit 477da3a448

@ -164,7 +164,7 @@ class FileDownloader implements DownloaderInterface
} catch (\Exception $e) { } catch (\Exception $e) {
// clean up // clean up
$this->filesystem->removeDirectory($path); $this->filesystem->removeDirectory($path);
$this->clearCache($package, $path); $this->clearCache($package, $path, $processedUrl);
throw $e; throw $e;
} }
@ -181,11 +181,11 @@ class FileDownloader implements DownloaderInterface
return $this; return $this;
} }
protected function clearCache(PackageInterface $package, $path) protected function clearCache(PackageInterface $package, $path, $processedUrl)
{ {
if ($this->cache) { if ($this->cache) {
$fileName = $this->getFileName($package, $path); $fileName = $this->getFileName($package, $path);
$this->cache->remove($this->getCacheKey($package)); $this->cache->remove($this->getCacheKey($package, $processedUrl));
} }
} }

Loading…
Cancel
Save