fix: resolve gallery crash when thumbnails exist and prevent thumbnail-as-image linking

- Fix AttributeError: 'str' has no attribute 'as_posix' on thumbnail_rel_path
  in get_output_images and find_duplicates (thumbnail_rel_path is already a
  string from f-string construction, not a Path object)
- Fix NameError: total_images undefined in generate_thumbnails (was defined as
  total_media, causing progress logging and response to fail)
- Add URL encoding for paths in scan_output_dir for filenames with spaces
- Exclude thumbnails directory from image monitor to prevent linking thumbnail
  files to prompts via fallback mechanism
- Bump version to 3.0.31
This commit is contained in:
Vito Sansevero
2026-02-03 14:07:23 -08:00
parent 9e575ab48c
commit f485825bfb
3 changed files with 24 additions and 17 deletions
+8 -4
View File
@@ -84,14 +84,18 @@ class ImageGenerationHandler(FileSystemEventHandler):
).start()
def is_image_file(self, filepath: str) -> bool:
"""Check if file is a supported image format.
"""Check if file is a supported image format and not a thumbnail.
Args:
filepath: Path to the file to check
Returns:
True if the file has a supported image extension, False otherwise
True if the file has a supported image extension and is not
inside a thumbnails directory, False otherwise
"""
# Skip files in thumbnails directory - those are derivatives, not generated images
if '/thumbnails/' in filepath or '\\thumbnails\\' in filepath:
return False
return filepath.lower().endswith(('.png', '.jpg', '.jpeg', '.webp', '.gif'))
def process_new_image(self, image_path: str):