From 3a4e05bd5c5e2d255b06eac46d2bff576ac50cb8 Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Tue, 15 Oct 2024 23:13:10 +0300 Subject: [PATCH] Fix graphics creation and selection error (Thanks. ThUnD3r|Gr33n). --- fasi.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fasi.py b/fasi.py index fc2d147..8ba0d22 100644 --- a/fasi.py +++ b/fasi.py @@ -149,7 +149,7 @@ class HttpInstance: jid_bare, jid_info, jid_kind, node_name) # Graphic files - filename, filepath, filetype, selection = FileUtilities.handle_photo(jid_bare, jid_vcard) + filename, filepath, filetype, selection = FileUtilities.handle_photo(jid_bare, jid_vcard, link_href) #except Exception as e: else: @@ -827,18 +827,20 @@ class FileUtilities: print(jid_details) + FileUtilities.handle_photo(jid_bare, jid_vcard, link_href) + filename = 'details/{}.toml'.format(jid_bare) Data.save_to_toml(filename, jid_details) return jid_details - def handle_photo(jid_bare, jid_vcard): + def handle_photo(jid_bare, jid_vcard, link_href): filetype = selection = None filecirca = 'photo/{}.*'.format(jid_bare) - filepath = glob.glob(filecirca) - if filepath: - filepath = filepath[0] - filetype = filepath.split('.').pop() + filepath_guess = glob.glob(filecirca) + if filepath_guess: + filepath_guess = filepath_guess[0] + filetype = filepath_guess.split('.').pop() filename = '{}.{}'.format(jid_bare, filetype) elif jid_vcard: mimetype = filename = filepath = None