From e7c183f51cf77e9e313f15cb62a7390f62503eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Wed, 6 Nov 2024 13:28:09 +0100 Subject: [PATCH] Fix bug with backwards clipboard compatibility Check if metadata file is not stale when copying/pasting from global clipboard instead of using it blindly. Also fixed a minor name bug. --- qui/clipboard.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qui/clipboard.py b/qui/clipboard.py index aa1da44..24dc28a 100644 --- a/qui/clipboard.py +++ b/qui/clipboard.py @@ -172,7 +172,8 @@ def process_IN_CLOSE_WRITE(self, _unused=None): ''' Reacts to modifications of the FROM file ''' metadata = {} with appviewer_lock(): - if os.path.isfile(METADATA): + if (os.path.isfile(METADATA) and + os.path.getmtime(METADATA) >= os.path.getmtime(DATA)): # parse JSON .metadata file if qubes-guid protocol 1.8 or newer try: with open(METADATA, 'r', encoding='ascii') as metadata_file: @@ -196,7 +197,7 @@ def process_IN_CLOSE_WRITE(self, _unused=None): metadata["sent_size"] = 0 metadata["cleared"] = metadata["sent_size"] == 0 - metadata["qrexec_request"] = False + metadata["qrexec_clipboard"] = False metadata["malformed_request"] = False metadata["oversized_request"] = metadata["sent_size"] >= 65000 metadata["buffer_size"] = 65000