Skip to content

The agent engineering platform.

community: Fix ConfluenceLoader load() failure caused by deleted pages (#29232)

Jin Hyung Ahn05554265b4c3
diff --git a/libs/community/langchain_community/document_loaders/confluence.py b/libs/community/langchain_community/document_loaders/confluence.py
index 225488c9ce..d8c5efa874 100644
--- a/libs/community/langchain_community/document_loaders/confluence.py
+++ b/libs/community/langchain_community/document_loaders/confluence.py
@@ -523,11 +523,14 @@ class ConfluenceLoader(BaseLoader):
def is_public_page(self, page: dict) -> bool:
"""Check if a page is publicly accessible."""
+
+ if page["status"] != "current":
+ return False
+
restrictions = self.confluence.get_all_restrictions_for_content(page["id"])
return (
- page["status"] == "current"
- and not restrictions["read"]["restrictions"]["user"]["results"]
+ not restrictions["read"]["restrictions"]["user"]["results"]
and not restrictions["read"]["restrictions"]["group"]["results"]
)