From 57cb76931742822e3b1e26ff72ae0d8c1b86c7cb Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 21 Jul 2022 15:22:54 +1000 Subject: [PATCH] Handle exception when path is not relative to base path (#3378) (cherry picked from commit 2bdba081b5a867825501c62a005aeeb0fd5f8828) --- 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 d5f6a7bccf..5f4a1e0b73 100644 --- a/InvenTree/plugin/plugin.py +++ b/InvenTree/plugin/plugin.py @@ -307,7 +307,11 @@ class InvenTreePlugin(MixinBase, MetaBase): """ 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):