From 2bdba081b5a867825501c62a005aeeb0fd5f8828 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 20 Jul 2022 18:30:19 +1000 Subject: [PATCH] Handle exception when path is not relative to base path --- InvenTree/plugin/plugin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/InvenTree/plugin/plugin.py b/InvenTree/plugin/plugin.py index 38d4982f6e..b59b42bc3b 100644 --- a/InvenTree/plugin/plugin.py +++ b/InvenTree/plugin/plugin.py @@ -275,7 +275,11 @@ class InvenTreePlugin(MixinBase, MetaBase): """Path to the plugin.""" if self._is_package: return self.__module__ # pragma: no cover - return pathlib.Path(self.def_path).relative_to(settings.BASE_DIR) + + try: + return pathlib.Path(self.def_path).relative_to(settings.BASE_DIR) + except ValueError: + return pathlib.Path(self.def_path) @property def settings_url(self):