From 6c27964edd2213671f3c859653dcb9afb49d1c49 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Mon, 10 Jun 2024 14:12:50 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(custom=5Fcomponent.py):=20fix?= =?UTF-8?q?=20resolving=20path=20logic=20to=20handle=20empty=20path=20inpu?= =?UTF-8?q?t=20and=20check=20if=20path=20parts=20exist=20before=20accessin?= =?UTF-8?q?g=20the=20first=20part?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../langflow/custom/custom_component/custom_component.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/base/langflow/custom/custom_component/custom_component.py b/src/backend/base/langflow/custom/custom_component/custom_component.py index 896b07337..5c1da081b 100644 --- a/src/backend/base/langflow/custom/custom_component/custom_component.py +++ b/src/backend/base/langflow/custom/custom_component/custom_component.py @@ -126,8 +126,11 @@ class CustomComponent(Component): @staticmethod def resolve_path(path: str) -> str: """Resolves the path to an absolute path.""" + if not path: + return path path_object = Path(path) - if path_object.parts[0] == "~": + + if path_object.parts and path_object.parts[0] == "~": path_object = path_object.expanduser() elif path_object.is_relative_to("."): path_object = path_object.resolve()