From 24c170f4ef76d121b72648e6bab00182415c214b Mon Sep 17 00:00:00 2001 From: ScarletEmanu Date: Wed, 17 Jun 2026 13:01:00 +0200 Subject: [PATCH] add checks in _write_plugin_to_temp_file --- archinstall/lib/args.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/args.py b/archinstall/lib/args.py index bb71ad5c..cfcfd478 100644 --- a/archinstall/lib/args.py +++ b/archinstall/lib/args.py @@ -666,6 +666,10 @@ class ArchConfigHandler: sys.exit(1) def _write_plugin_to_temp_file(self, plugin_data: str) -> Path: + if not plugin_data.strip(): + error('The downloaded plugin is empty') + sys.exit(1) + tmp_file = tempfile.NamedTemporaryFile( mode='w', suffix='.py', @@ -673,8 +677,12 @@ class ArchConfigHandler: delete=False, ) - with tmp_file as f: - f.write(plugin_data) + try: + with tmp_file as f: + f.write(plugin_data) + except OSError as err: + error(f'Could not write the downloaded plugin to a temporary file: {err}') + sys.exit(1) return Path(tmp_file.name)