v2.6.2
This commit is contained in:
+4
-3
@@ -469,13 +469,14 @@ def resolve_image_path(image_path: str, project_dir: str, workspace_path: str) -
|
||||
if os.path.exists(c):
|
||||
print(f"[pptx_gen] resolve_image_path: {image_path} -> {c} (found)", file=sys.stderr, flush=True)
|
||||
return c
|
||||
# Fallback: search by filename in all subdirectories
|
||||
# Fallback: search by filename within project_dir only (NOT workspace-wide — generic names like
|
||||
# slide2_image.jpg would match other projects' images and corrupt the presentation)
|
||||
basename = os.path.basename(image_path).lower()
|
||||
for root, dirs, files in os.walk(workspace_path):
|
||||
for root, dirs, files in os.walk(project_dir):
|
||||
for f in files:
|
||||
if f.lower() == basename:
|
||||
resolved = os.path.join(root, f)
|
||||
print(f"[pptx_gen] resolve_image_path: {image_path} -> {resolved} (found by filename search)", file=sys.stderr, flush=True)
|
||||
print(f"[pptx_gen] resolve_image_path: {image_path} -> {resolved} (found in project_dir)", file=sys.stderr, flush=True)
|
||||
return resolved
|
||||
print(f"[pptx_gen] resolve_image_path: {image_path} NOT FOUND in {project_dir} or {workspace_path}", file=sys.stderr, flush=True)
|
||||
return candidates[0] # return first even if missing (placeholder will show)
|
||||
|
||||
Reference in New Issue
Block a user