diff --git a/modules/subcore.py b/modules/subcore.py index ca187e3..5b2da74 100644 --- a/modules/subcore.py +++ b/modules/subcore.py @@ -87,9 +87,9 @@ def load_whitelist(filepath): except FileNotFoundError: # This block now runs only if the directory was created successfully but the file is missing logging.warning(f"[Impact Pack/Subpack] Model whitelist file not found at: {filepath}. ") - logging.warning(f" >> An empty whitelist file will be created.") - logging.warning(f" >> To allow unsafe loading for specific trusted legacy models (e.g., older .pt),") - logging.warning(f" >> add their base filenames (one per line) to this file.") + logging.warning(" >> An empty whitelist file will be created.") + logging.warning(" >> To allow unsafe loading for specific trusted legacy models (e.g., older .pt),") + logging.warning(" >> add their base filenames (one per line) to this file.") try: # Attempt to create the file with comments since it wasn't found # This should now succeed because os.makedirs created the directory @@ -139,7 +139,7 @@ def restricted_getattr(obj, name, *args): if name != "forward": logging.error(f"Access to potentially dangerous attribute '{obj.__module__}.{obj.__name__}.{name}' is blocked.\nIf you believe the use of this code is genuinely safe, please report it.\nhttps://github.com/ltdrdata/ComfyUI-Impact-Subpack/issues") raise RuntimeError(f"Access to potentially dangerous attribute '{obj.__module__}.{obj.__name__}.{name}' is blocked.") - + return getattr(obj, name, *args) restricted_getattr.__module__ = 'builtins' @@ -313,7 +313,7 @@ def torch_wrapper(*args, **kwargs): if filename and filename in _MODEL_WHITELIST: logging.warning("##############################################################################") logging.warning(f"[Impact Pack/Subpack] SUCCESS: File '{filename}' FOUND in reloaded whitelist.") - logging.warning(f" >> Proceeding with whitelisted unsafe load (weights_only=False).") + logging.warning(" >> Proceeding with whitelisted unsafe load (weights_only=False).") logging.warning(f" >> Ensure you recently added this file to: {whitelist_path_msg}") logging.warning(" >> SECURITY RISK: Ensure you trust its source.") logging.warning("##############################################################################") @@ -332,15 +332,15 @@ def torch_wrapper(*args, **kwargs): # --- Blocked: Not Whitelisted (Original Logic - runs if reload failed or file still not found) --- logging.error("##############################################################################") logging.error(f"[Impact Pack/Subpack] ERROR: Safe load failed for '{filename_arg_source}' (Reason: {e}).") - logging.error(f" >> This model likely uses legacy Python features blocked by default for security.") + logging.error(" >> This model likely uses legacy Python features blocked by default for security.") # Updated log message here: logging.error(f" >> UNSAFE LOAD BLOCKED because the file ('{filename or 'unknown'}') is NOT in the whitelist (even after reload attempt).") logging.error(f" >> Whitelist path: {whitelist_path_msg}") if filename: - logging.error(f" >> To allow loading this specific file (IF YOU TRUST IT), ensure its base name") + logging.error(" >> To allow loading this specific file (IF YOU TRUST IT), ensure its base name") logging.error(f" >> ('{filename}') is correctly added to the whitelist file (one name per line) and saved.") else: - logging.error(f" >> Cannot determine filename to check against whitelist.") + logging.error(" >> Cannot determine filename to check against whitelist.") logging.error(" >> SECURITY RISK: Only whitelist files from sources you absolutely trust.") logging.error(" >> Prefer using .safetensors files whenever available.") logging.error("##############################################################################") @@ -596,4 +596,4 @@ class UltraSegmDetector: return utils.combine_masks(segmasks) def setAux(self, x): - pass \ No newline at end of file + pass diff --git a/modules/subpack_nodes.py b/modules/subpack_nodes.py index 4fe2eae..01d59c9 100644 --- a/modules/subpack_nodes.py +++ b/modules/subpack_nodes.py @@ -36,7 +36,7 @@ class UltralyticsDetectorProvider: model_path = folder_paths.get_full_path("ultralytics_bbox", model_name[5:]) elif model_name.startswith('segm/'): model_path = folder_paths.get_full_path("ultralytics_segm", model_name[5:]) - + if model_path is None: logging.error(f"[Impact Subpack] model file '{model_name}' is not found in one of the following directories:")