Skip to content

Commit a99feb5

Browse files
authored
Fix issue #1554: Preserve custom thumbnails in gallery script (#1649)
* Initial plan * Fix issue #1554: Preserve custom thumbnails in gallery script Modified scripts/generate_gallery.py to check if a thumbnail file already exists before extracting from notebooks. This prevents the script from overwriting manually-placed custom thumbnails in the _thumbnails directory. The gen_previews() method now: 1. Checks if self.png_path exists 2. If yes, logs info message and returns early (preserving custom thumbnail) 3. If no, proceeds with extraction from notebook or uses default logo Fixes #1554 --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]>
1 parent db5178b commit a99feb5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/generate_gallery.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ def extract_preview_pic(self):
118118
return None
119119

120120
def gen_previews(self):
121+
if self.png_path.exists():
122+
logger.info(
123+
f"Custom thumbnail already exists for {self.basename}, skipping extraction",
124+
type="thumbnail_extractor",
125+
)
126+
return
127+
121128
preview = self.extract_preview_pic()
122129
if preview is not None:
123130
with self.png_path.open("wb") as buff:

0 commit comments

Comments
 (0)