Bug fix: SHA1 mismatch because old file was not removed

This occurred after 1.19.x had got assets update for the upcoming
1.19.3 release.
This commit is contained in:
Duy Tran Khanh committed 2022-10-20 11:18:14 +07:00
1 parent 8218a28e4d
commit 5c8d2f9cdc
1 file changed
+3 -1
+3 -1
View File
@@ -199,7 +199,8 @@ static AFURLSessionManager* manager;
NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull progress){
callback([NSString stringWithFormat:@"Downloading %@.json", versionStr], mainProgress, progress);
} destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
} destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
[NSFileManager.defaultManager removeItemAtPath:jsonPath error:nil];
return [NSURL fileURLWithPath:jsonPath];
} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) {
if (error != nil) { // FIXME: correct?
@@ -437,6 +438,7 @@ static AFURLSessionManager* manager;
NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull progress){
callback([NSString stringWithFormat:@"Downloading %@", name], progress);
} destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
[NSFileManager.defaultManager removeItemAtPath:path error:nil];
return [NSURL fileURLWithPath:path];
} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) {
if (error != nil) {