From 5c8d2f9cdc3fe2514304007fbdb43436bebf2bcf Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh Date: Thu, 20 Oct 2022 11:18:14 +0700 Subject: [PATCH] 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. --- Natives/MinecraftResourceUtils.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Natives/MinecraftResourceUtils.m b/Natives/MinecraftResourceUtils.m index ae765c4a..1814d6e4 100644 --- a/Natives/MinecraftResourceUtils.m +++ b/Natives/MinecraftResourceUtils.m @@ -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) {