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

This commit is contained in:
yalei 2024-04-26 18:04:37 +08:00 committed by GitHub
parent 2a8881d0e8
commit 4d66a86579
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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']