0001-gui-fix-restore-dedup-logic.patch

#616
Raw
Created
Dec. 15, 2022, 2:26 a.m.
Expires
Never
Size
850 bytes
Hits
195
Syntax
Diff
Private
No
From bc490fae178e9b7bcf0a2f291ab1cef2cae5dfce Mon Sep 17 00:00:00 2001
From: Winston Weinert <git@winny.tech>
Date: Wed, 14 Dec 2022 20:25:53 -0600
Subject: [PATCH] gui: fix restore dedup logic

---
 gui/main.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gui/main.go b/gui/main.go
index 245ea29..7e1b8d7 100644
--- a/gui/main.go
+++ b/gui/main.go
@@ -98,7 +98,7 @@ func Run() {
 		digestHex := hex.EncodeToString(digest)
 		relPath := digestHex
 		var existing *StoredSaveFile = nil
-		if db.Where("sha256_hex = ?", digestHex).Find(&existing); existing != nil {
+		if db.Where("sha256_hex = ?", digestHex).Find(&existing).RowsAffected > 0 && existing != nil {
 			fmt.Fprintf(os.Stderr, "Saw save we already have in DB, skipping (%s).\n", digestHex)
 			return
 		}
-- 
2.34.1.windows.1