You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: cache not cleaned up if download fails (#7663)
If a server returns an error when trying to download a binaryTarget an
invalid file remains in the artifacts cache.
### Motivation:
If the download of a binaryTarget fails a cache file still remains in
the artifact cache.
The file only contains the server's response which is usually the status
code and the error message.
Example:
```
$ ls ~/Library/Caches/org.swift.swiftpm/artifacts
.
..
https___test_example_local_foo_zip
$ cat ~/Library/Caches/org.swift.swiftpm/artifacts/https___test_example_local_foo_zip
404 page not found
```
Worse, all following `resolve` calls therefore fail because the cached
file is used but is an invalid archive.
### Modifications:
If the download fails the cache file in the artifacts cache is deleted.
### Result:
As expected, the artifacts folder is empty.
Example:
```
$ ls ~/Library/Caches/org.swift.swiftpm/artifacts
.
..
```
0 commit comments