From 74a7835b356b5e06257244c5bf6aba3f1398b883 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Wed, 12 Mar 2025 17:36:46 +0100 Subject: [PATCH] Fixed privacy plugin crashing on non-existent file --- material/plugins/privacy/plugin.py | 6 ++++-- src/plugins/privacy/plugin.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/material/plugins/privacy/plugin.py b/material/plugins/privacy/plugin.py index 106b9d203..fbf2d424a 100644 --- a/material/plugins/privacy/plugin.py +++ b/material/plugins/privacy/plugin.py @@ -200,9 +200,11 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]): self._patch, file )) - # Otherwise just copy external asset to output directory + # Otherwise just copy external asset to output directory if it + # exists, i.e., if the download succeeded else: - file.copy_file() + if os.path.exists(file.abs_src_path): + file.copy_file() # Reconcile concurrent jobs for the last time, so the plugins following # in the build process always have a consistent state to work with diff --git a/src/plugins/privacy/plugin.py b/src/plugins/privacy/plugin.py index 106b9d203..fbf2d424a 100644 --- a/src/plugins/privacy/plugin.py +++ b/src/plugins/privacy/plugin.py @@ -200,9 +200,11 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]): self._patch, file )) - # Otherwise just copy external asset to output directory + # Otherwise just copy external asset to output directory if it + # exists, i.e., if the download succeeded else: - file.copy_file() + if os.path.exists(file.abs_src_path): + file.copy_file() # Reconcile concurrent jobs for the last time, so the plugins following # in the build process always have a consistent state to work with