mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
fix: Use a temporary directory with a simple filename for clipboard images
This commit is contained in:
parent
27af9414d5
commit
604a1fcae4
1 changed files with 3 additions and 5 deletions
|
@ -902,11 +902,9 @@ class Commands:
|
||||||
image = ImageGrab.grabclipboard()
|
image = ImageGrab.grabclipboard()
|
||||||
if isinstance(image, Image.Image):
|
if isinstance(image, Image.Image):
|
||||||
basename = args.strip() if args.strip() else "clipboard_image"
|
basename = args.strip() if args.strip() else "clipboard_image"
|
||||||
with tempfile.NamedTemporaryFile(
|
temp_dir = tempfile.mkdtemp()
|
||||||
prefix=f"{basename}_", suffix=".png", delete=False
|
temp_file_path = os.path.join(temp_dir, f"{basename}.png")
|
||||||
) as temp_file:
|
image.save(temp_file_path, "PNG")
|
||||||
image.save(temp_file.name, "PNG")
|
|
||||||
temp_file_path = temp_file.name
|
|
||||||
|
|
||||||
abs_file_path = Path(temp_file_path).resolve()
|
abs_file_path = Path(temp_file_path).resolve()
|
||||||
self.coder.abs_fnames.add(str(abs_file_path))
|
self.coder.abs_fnames.add(str(abs_file_path))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue