Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ private async Task ProcessFileAsync(PCL.Network.DownloadFile file, CancellationT
{
await FileDownloader.Download(file.Urls, file.LocalPath, file.UseBrowserUserAgent, file.CustomUserAgent,
cancellationToken, enableParallelChunks, file).ConfigureAwait(false);
var checkError = file.Check?.Check(file.LocalPath);
if (checkError is not null)
throw new IOException($"下载文件校验失败:{checkError}");
Comment on lines +140 to +142

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Try alternate mirrors after checksum failures

When the first URL returns a complete but invalid file, this check throws only after FileDownloader.Download(...) has already returned; DownloadCoreAsync stops at the first transport-successful URL (FileDownloader.cs lines 51-57), so the exception is caught by the outer retry loop and the same first URL is retried up to four times instead of falling through to later mirrors. For multi-source downloads where mirror 1 is corrupt or malicious but mirror 2 is valid, this makes the whole download fail despite an available good source; the integrity check needs to participate in the per-URL failure path or otherwise advance to the next URL.

Useful? React with 👍 / 👎.

break;
}
catch (OperationCanceledException)
Expand Down
Loading