mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +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()
|
||||
if isinstance(image, Image.Image):
|
||||
basename = args.strip() if args.strip() else "clipboard_image"
|
||||
with tempfile.NamedTemporaryFile(
|
||||
prefix=f"{basename}_", suffix=".png", delete=False
|
||||
) as temp_file:
|
||||
image.save(temp_file.name, "PNG")
|
||||
temp_file_path = temp_file.name
|
||||
temp_dir = tempfile.mkdtemp()
|
||||
temp_file_path = os.path.join(temp_dir, f"{basename}.png")
|
||||
image.save(temp_file_path, "PNG")
|
||||
|
||||
abs_file_path = Path(temp_file_path).resolve()
|
||||
self.coder.abs_fnames.add(str(abs_file_path))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue