Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: fetch page name of notion wiki (#3847)

yalei4d66a865791c
diff --git a/api/libs/oauth_data_source.py b/api/libs/oauth_data_source.py
index 7891b01182d..a865ee85ab5 100644
--- a/api/libs/oauth_data_source.py
+++ b/api/libs/oauth_data_source.py
@@ -153,23 +153,12 @@ class NotionOAuth(OAuthDataSource):
# get page detail
for page_result in page_results:
page_id = page_result['id']
- if 'Name' in page_result['properties']:
- if len(page_result['properties']['Name']['title']) > 0:
- page_name = page_result['properties']['Name']['title'][0]['plain_text']
- else:
- page_name = 'Untitled'
- elif 'title' in page_result['properties']:
- if len(page_result['properties']['title']['title']) > 0:
- page_name = page_result['properties']['title']['title'][0]['plain_text']
- else:
- page_name = 'Untitled'
- elif 'Title' in page_result['properties']:
- if len(page_result['properties']['Title']['title']) > 0:
- page_name = page_result['properties']['Title']['title'][0]['plain_text']
- else:
- page_name = 'Untitled'
- else:
- page_name = 'Untitled'
+ page_name = 'Untitled'
+ for key in ['Name', 'title', 'Title', 'Page']:
+ if key in page_result['properties']:
+ if len(page_result['properties'][key].get('title', [])) > 0:
+ page_name = page_result['properties'][key]['title'][0]['plain_text']
+ break
page_icon = page_result['icon']
if page_icon:
icon_type = page_icon['type']