mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 22:52:12 -03:00
Normalize SHA256 hash handling by converting to lowercase in LoraScanner and LoraMetadata classes for consistency.
This commit is contained in:
@@ -102,7 +102,7 @@ class LoraScanner:
|
|||||||
# Build hash index and tags count
|
# Build hash index and tags count
|
||||||
for lora_data in raw_data:
|
for lora_data in raw_data:
|
||||||
if 'sha256' in lora_data and 'file_path' in lora_data:
|
if 'sha256' in lora_data and 'file_path' in lora_data:
|
||||||
self._hash_index.add_entry(lora_data['sha256'], lora_data['file_path'])
|
self._hash_index.add_entry(lora_data['sha256'].lower(), lora_data['file_path'])
|
||||||
|
|
||||||
# Count tags
|
# Count tags
|
||||||
if 'tags' in lora_data and lora_data['tags']:
|
if 'tags' in lora_data and lora_data['tags']:
|
||||||
@@ -649,11 +649,11 @@ class LoraScanner:
|
|||||||
# Add new methods for hash index functionality
|
# Add new methods for hash index functionality
|
||||||
def has_lora_hash(self, sha256: str) -> bool:
|
def has_lora_hash(self, sha256: str) -> bool:
|
||||||
"""Check if a LoRA with given hash exists"""
|
"""Check if a LoRA with given hash exists"""
|
||||||
return self._hash_index.has_hash(sha256)
|
return self._hash_index.has_hash(sha256.lower())
|
||||||
|
|
||||||
def get_lora_path_by_hash(self, sha256: str) -> Optional[str]:
|
def get_lora_path_by_hash(self, sha256: str) -> Optional[str]:
|
||||||
"""Get file path for a LoRA by its hash"""
|
"""Get file path for a LoRA by its hash"""
|
||||||
return self._hash_index.get_path(sha256)
|
return self._hash_index.get_path(sha256.lower())
|
||||||
|
|
||||||
def get_lora_hash_by_path(self, file_path: str) -> Optional[str]:
|
def get_lora_hash_by_path(self, file_path: str) -> Optional[str]:
|
||||||
"""Get hash for a LoRA by its file path"""
|
"""Get hash for a LoRA by its file path"""
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class LoraMetadata:
|
|||||||
file_path=save_path.replace(os.sep, '/'),
|
file_path=save_path.replace(os.sep, '/'),
|
||||||
size=file_info.get('sizeKB', 0) * 1024,
|
size=file_info.get('sizeKB', 0) * 1024,
|
||||||
modified=datetime.now().timestamp(),
|
modified=datetime.now().timestamp(),
|
||||||
sha256=file_info['hashes'].get('SHA256', ''),
|
sha256=file_info['hashes'].get('SHA256', '').lower(),
|
||||||
base_model=base_model,
|
base_model=base_model,
|
||||||
preview_url=None, # Will be updated after preview download
|
preview_url=None, # Will be updated after preview download
|
||||||
preview_nsfw_level=0, # Will be updated after preview download, it is decided by the nsfw level of the preview image
|
preview_nsfw_level=0, # Will be updated after preview download, it is decided by the nsfw level of the preview image
|
||||||
|
|||||||
Reference in New Issue
Block a user