mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
feat: Add support for reading SHA256 from .sha256 file in get_file_info function
This commit is contained in:
@@ -93,6 +93,17 @@ async def get_file_info(file_path: str, model_class: Type[BaseModelMetadata] = L
|
|||||||
logger.debug(f"Using SHA256 from .json file for {file_path}")
|
logger.debug(f"Using SHA256 from .json file for {file_path}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error reading .json file for {file_path}: {e}")
|
logger.error(f"Error reading .json file for {file_path}: {e}")
|
||||||
|
|
||||||
|
# If SHA256 is still not found, check for a .sha256 file
|
||||||
|
if sha256 is None:
|
||||||
|
sha256_file = f"{os.path.splitext(file_path)[0]}.sha256"
|
||||||
|
if os.path.exists(sha256_file):
|
||||||
|
try:
|
||||||
|
with open(sha256_file, 'r', encoding='utf-8') as f:
|
||||||
|
sha256 = f.read().strip().lower()
|
||||||
|
logger.debug(f"Using SHA256 from .sha256 file for {file_path}")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error reading .sha256 file for {file_path}: {e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# If we didn't get SHA256 from the .json file, calculate it
|
# If we didn't get SHA256 from the .json file, calculate it
|
||||||
|
|||||||
Reference in New Issue
Block a user