From f6ce4cb29f3777e42b230e36486a6a71bb329586 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Thu, 22 Oct 2009 22:21:55 +0000
Subject: [PATCH]     * Update: Better error message when .sud file not found
 or truncated       http://forum.i2p/viewtopic.php?t=3979       The bug with
 the file going to the wrong place was fixed a couple months ago.

---
 core/java/src/net/i2p/crypto/TrustedUpdate.java | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/core/java/src/net/i2p/crypto/TrustedUpdate.java b/core/java/src/net/i2p/crypto/TrustedUpdate.java
index 22f7609d99..d0f25aec5f 100644
--- a/core/java/src/net/i2p/crypto/TrustedUpdate.java
+++ b/core/java/src/net/i2p/crypto/TrustedUpdate.java
@@ -414,8 +414,14 @@ D8usM7Dxp5yrDrCYZ5AIijc=
      *         data was moved, and an error <code>String</code> otherwise.
      */
     public String migrateVerified(String currentVersion, File signedFile, File outputFile) {
-        if (!isUpdatedVersion(currentVersion, signedFile))
-            return "Downloaded version is not greater than current version";
+        if (!signedFile.exists())
+            return "File not found: " + signedFile.getAbsolutePath();
+        if (!isUpdatedVersion(currentVersion, signedFile)) {
+            if ("".equals(_newVersion))
+                return "Truncated or corrupt file: " + signedFile.getAbsolutePath();
+            else
+                return "Downloaded version is not greater than current version";
+        }
 
         if (!verify(signedFile))
             return "Unknown signing key or corrupt file";
-- 
GitLab