$NetBSD: patch-bj,v 1.7.8.1 2004/11/30 23:29:15 salo Exp $

--- uriloader/exthandler/nsExternalHelperAppService.cpp.orig	2004-11-11 15:56:52.000000000 +0100
+++ uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -1747,6 +1747,11 @@ nsresult nsExternalAppHandler::ExecuteDe
       // XXX Put progress dialog in barber-pole mode
       //     and change text to say "Copying from:".
       rv = MoveFile(mFinalFileDestination);
+      if (NS_SUCCEEDED(rv) && action == nsIMIMEInfo::saveToDisk)
+      {
+        nsCOMPtr<nsILocalFile> destfile(do_QueryInterface(mFinalFileDestination));
+        sSrv->FixFilePermissions(destfile);
+      }
     }
     
     // Notify dialog that download is complete.
@@ -1913,7 +1918,6 @@ nsresult nsExternalAppHandler::MoveFile(
      if (directoryLocation)
      {
        rv = mTempFile->MoveToNative(directoryLocation, fileName);
-       sSrv->FixFilePermissions(fileToUse);
      }
      if (NS_FAILED(rv))
      {
