@@ -33,26 +33,6 @@ const (
3333 checksumFileSuffix = ".sha256"
3434)
3535
36- // ChecksumMismatchError represents an error when the calculated checksum doesn't match the expected checksum.
37- // This type of error should not trigger retries as it indicates data corruption or tampering.
38- type ChecksumMismatchError struct {
39- Expected string
40- Actual string
41- }
42-
43- func (e * ChecksumMismatchError ) Error () string {
44- return fmt .Sprintf ("checksum mismatch: expected %s, got %s" , e .Expected , e .Actual )
45- }
46-
47- // HTTPStatusError represents an HTTP status code error for retry logic.
48- type HTTPStatusError struct {
49- StatusCode int
50- }
51-
52- func (e * HTTPStatusError ) Error () string {
53- return fmt .Sprintf ("unexpected status code: %d" , e .StatusCode )
54- }
55-
5636// RetryBackoffType defines supported backoff strategies.
5737type RetryBackoffType string
5838
@@ -197,16 +177,7 @@ func (f *DefaultFetcher) GetRemoteFile(targetURL string) ([]byte, error) {
197177 return nil , fmt .Errorf ("failed to fetch HTTP file after retries: %w" , err )
198178 }
199179
200- if result != nil {
201- return result , nil
202- }
203-
204- // This case should ideally not be reached, but as a fallback, return the last known error.
205- if lastErr != nil {
206- return nil , lastErr
207- }
208-
209- return nil , fmt .Errorf ("failed to fetch HTTP file %s: unknown error" , targetURL )
180+ return result , nil
210181}
211182
212183// getFileContent fetches content via HTTP(S).
0 commit comments