Use status code constants

This commit is contained in:
Ben Adrian Sarmiento
2024-06-10 17:17:40 +02:00
parent 0fde9a6856
commit 59c15ebb0a
3 changed files with 9 additions and 8 deletions

View File

@@ -163,7 +163,7 @@ func (dl *Downloader) streamFileToResponse(
defer downloadResp.Body.Close()
// Check if the download was not successful
if downloadResp.StatusCode/100 != 2 {
if downloadResp.StatusCode != http.StatusOK && downloadResp.StatusCode != http.StatusPartialContent {
log.Warnf("Received a %s status code for file %s", downloadResp.Status, unrestrict.Filename)
if file != nil {
if err := file.State.Event(context.Background(), "break_file"); err != nil {