From 30dcc7477f12d22d2dc8b17b9c61fc80e3e56bc7 Mon Sep 17 00:00:00 2001
From: JeLuF <jf@mormo.org>
Date: Sun, 28 May 2023 01:43:58 +0200
Subject: [PATCH] Fix GFPGAN settings import The word None which many txt
 metadata files contain as value for the GFPGAN field should not be considered
 to be a model name. If the value is None, disable the checkbox

---
 ui/media/js/dnd.js | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/ui/media/js/dnd.js b/ui/media/js/dnd.js
index 8b66a3a4..f8fd8ccc 100644
--- a/ui/media/js/dnd.js
+++ b/ui/media/js/dnd.js
@@ -172,16 +172,22 @@ const TASK_MAPPING = {
         name: "Use Face Correction",
         setUI: (use_face_correction) => {
             const oldVal = gfpganModelField.value
-            gfpganModelField.value = getModelPath(use_face_correction, [".pth"])
-            if (gfpganModelField.value) {
-                // Is a valid value for the field.
-                useFaceCorrectionField.checked = true
-                gfpganModelField.disabled = false
-            } else {
-                // Not a valid value, restore the old value and disable the filter.
+            console.log("use face correction", use_face_correction)
+            if (use_face_correction == null || use_face_correction == "None") {
                 gfpganModelField.disabled = true
-                gfpganModelField.value = oldVal
                 useFaceCorrectionField.checked = false
+            } else {
+                gfpganModelField.value = getModelPath(use_face_correction, [".pth"])
+                if (gfpganModelField.value) {
+                    // Is a valid value for the field.
+                    useFaceCorrectionField.checked = true
+                    gfpganModelField.disabled = false
+                } else {
+                    // Not a valid value, restore the old value and disable the filter.
+                    gfpganModelField.disabled = true
+                    gfpganModelField.value = oldVal
+                    useFaceCorrectionField.checked = false
+                }
             }
 
             //useFaceCorrectionField.checked = parseBoolean(use_face_correction)