Browse Source

Revert the new ProgressMax <> 0 check when reporting download progress: it's already documented it can be 0, see https://jrsoftware.org/ishelp/index.php?topic=isxfunc_downloadtemporaryfile.
Which mages sense, it might simply stay unknown. Also I noticed downloading https://github.com/jrsoftware/issrc/archive/refs/heads/main.zip actually receive a content length of -1, in which ase the new check does nothing .

Martijn Laan 5 tháng trước cách đây
mục cha
commit
155ebdfed4
1 tập tin đã thay đổi với 14 bổ sung16 xóa
  1. 14 16
      Projects/Src/Setup.DownloadFileFunc.pas

+ 14 - 16
Projects/Src/Setup.DownloadFileFunc.pas

@@ -186,24 +186,22 @@ begin
     System.TMonitor.Exit(FLock);
   end;
 
-  if ProgressMax <> 0 then begin
-    try
-      if Assigned(FOnDownloadProgress) then begin
-        if not FOnDownloadProgress(FCleanUrl, FBaseName, Progress, ProgressMax) then
-          FAbort := True; { Atomic so no lock }
-      end else if Assigned(FOnSimpleDownloadProgress) then begin
-        try
-          FOnSimpleDownloadProgress(Integer64(Progress-FLastReportedProgress), FOnSimpleDownloadProgressParam);
-        finally
-          FLastReportedProgress := Progress;
-        end;
+  try
+    if Assigned(FOnDownloadProgress) then begin
+      if not FOnDownloadProgress(FCleanUrl, FBaseName, Progress, ProgressMax) then
+        FAbort := True; { Atomic so no lock }
+    end else if Assigned(FOnSimpleDownloadProgress) then begin
+      try
+        FOnSimpleDownloadProgress(Integer64(Progress-FLastReportedProgress), FOnSimpleDownloadProgressParam);
+      finally
+        FLastReportedProgress := Progress;
       end;
-    except
-      if ExceptObject is EAbort then { FOnSimpleDownloadProgress always uses Abort to abort }
-        FAbort := True { Atomic so no lock }
-      else
-        raise;
     end;
+  except
+    if ExceptObject is EAbort then { FOnSimpleDownloadProgress always uses Abort to abort }
+      FAbort := True { Atomic so no lock }
+    else
+      raise;
   end;
 
   if DownloadTemporaryFileOrExtractArchiveProcessMessages then