fix: clean up empty file after failed wl-paste clipboard extraction
When wl-paste produces empty output, the destination file was left as a 0-byte orphan. Added dest.unlink() before returning False, matching the existing cleanup pattern in the exception handler. Authored by 0xbyt4. Co-authored-by: 0xbyt4 <0xbyt4@users.noreply.github.com>
This commit is contained in:
commit
f524aed23e
1 changed files with 1 additions and 0 deletions
|
|
@ -254,6 +254,7 @@ def _wayland_save(dest: Path) -> bool:
|
||||||
)
|
)
|
||||||
|
|
||||||
if not dest.exists() or dest.stat().st_size == 0:
|
if not dest.exists() or dest.stat().st_size == 0:
|
||||||
|
dest.unlink(missing_ok=True)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# BMP needs conversion to PNG (common in WSLg where only BMP
|
# BMP needs conversion to PNG (common in WSLg where only BMP
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue